Browse to get _changes with specific values

I can get the last modified document using:

localhost:5984/_changes 

and then use the returned documentID and get the document using

 localhost:5984/documentID 

I was wondering if I can combine them in the form - the view will execute _changes, get the document with specific document identifiers and return them

+6
source share
1 answer

Query changes can also include the entire document if you add the parameter ?include_docs=true .

To see only some documents, and not all of them, you can use the filtering functions: http://guide.couchdb.org/draft/notifications.html#filters

When calling the filtered _changes feed, you can also specify parameters, i.e.

  localhost:5984/db/_changes?include_docs=true&filter=foo/docs&id=docid 

Use as a filter:

 function(doc, req) { if(doc._id == req.query.id) { return true; } return false; } 

This will only return documents that match the filter, including document bodies.

+6
source

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


All Articles