couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Wolff <>
Subject rev of aggregate results
Date Fri, 03 Apr 2009 18:32:25 GMT
I've noticed a pattern that appears in a couple of places in our app.
We have views which return multiple documents for a given key. What's
the fastest way that we can determine if we have the current rev of
the view, if we define a view's rev as the id and revs of all the
documents in the view?

The solution I've thought of so far is to write the view's map
function like this:

map : function(doc){
   var key = computeKey(doc);
   emit([key,, doc.rev], null);

We query the view with startkey=[key, null, null]&endkey=[key, {}, {}]
and the rev for that key is just the text of the response. We haven't
gotten all the way through this, but it sees like it should work. My
concern is that this string will get unwieldy when there are a lot of
docs in the result set.

Is there a recipe for determining the rev of a document collection?
Something in the semantics of id or rev that I've missed?

Thanks in advance,

View raw message