incubator-couchdb-user mailing list archives

Re: CouchDB: Most recently added document that is NOT a design document

Date

Tue, 07 Jan 2014 00:01:13 GMT

read _changes?descending=true row by row until you reach a non-design document? The doc to
ddoc ratio should be strongly in your favor.
B.
On 6 Jan 2014, at 22:00, Stanley Iriele <siriele2x3@gmail.com> wrote:
> Could you do what Jens just mentioned and just make a filter?....that way a
> seq number plus the filter should get you what you want
> On Jan 6, 2014 1:28 PM, "Jens Alfke" <jens@couchbase.com> wrote:
>
>>
>> On Jan 6, 2014, at 12:42 PM, Hank Knight <hknight555@gmail.com> wrote:
>>
>>> I want the ID of the most recently added document that is NOT a design
>>> document.
>>
>> There’s nothing built-in for that. CouchDB doesn’t track the order in
>> which documents are created, only the order in which they’re changed.
>>
>> You could put a “date_created” property in a document and populate it with
>> a timestamp when the doc is first created; then you can make a view that
>> emits those as keys, and query it in reverse order.
>>
>> —Jens