couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lars <>
Subject Re: CouchDB: Most recently added document that is NOT a design document
Date Tue, 07 Jan 2014 01:13:56 GMT
On 07.01.2014 01:53, Jens Alfke wrote:
> On Jan 6, 2014, at 4:16 PM, Lars <> wrote:
>> It might depend on your definition of "added document". If `PUT
>> /db/docid` and `POST /db` are the only ways to "add", then do what Bob
>> said and stop at the first non-design document with a seq number of 1.
> That’s still going to return documents by order modified, not created.
> I think you mean “generation number”, not “seq number”, as only the first document
ever added to the db will have a sequence number of 1. And you’ll only see a generation
number of 1 if the doc’s never been updated after the initial add, so this isn’t useful
in the general case.

Yep sorry, I mean the number part of the revision. It being 1 is the
only way to tell addition and update apart, though, isn't it?

>> It starts getting tricky if you also include in your definition
>> documents that are created by replication, and I'm not sure how to
>> handle that.
> It’s not really any different. They appear in the _changes feed just as local changes

But you only get the leaf revisions of the documents, not neccessarily
the first revision, which "added" the document.

> —Jens

View raw message