Reputation: 733
I can get the latest changed document by using:
localhost:5984/_changes
and then use the documentID's returned and obtain the document using
localhost:5984/documentID
I was wondering if I can combine them into a view - the view would execute _changes, get the document with the specific documentIDs and return those
Upvotes: 6
Views: 2369
Reputation: 21261
Changes queries can also include the entire document if you add a ?include_docs=true
parameter.
To see only some documents instead of all of them, you can use filter functions: http://guide.couchdb.org/draft/notifications.html#filters
When calling a filtered _changes feed, you can also provide parameters, i.e.
localhost:5984/db/_changes?include_docs=true&filter=foo/docs&id=docid
Using as filter:
function(doc, req)
{
if(doc._id == req.query.id) {
return true;
}
return false;
}
This will return only those documents matching the filter, including the document bodies.
Upvotes: 6