CouchDB, how to get only document changes

Using /_changes?filter=_design , I can get all the changes for the project documents.

How do I get all changes for documents only?

Is there such a thing as /_changes?filter=_docs_only ???

+6
source share
1 answer

There is no built-in filter for this. You will need to write your own filter function ( http://couchdb.readthedocs.org/en/latest/couchapp/ddocs.html#filterfun ) that excludes project documents (check the _id document for "_design/" , etc .. ) from the feed. You then refer to this filter function when you request a change feed ( http://couchdb.readthedocs.org/en/latest/api/database/changes.html?highlight=changes ). However, most applications do not come across this too often, as project documents are usually updated only when the application changes.

It would probably be more efficient to implement this filter on the client side instead of pushing all your changes to the couchjs process (always inefficient). As your application goes through changes, just check if there is a project there.

Greetings.

+5
source

Source: https://habr.com/ru/post/969463/


All Articles