Re: getting most recent doc

2010-04-19 Thread Adam Kocoloski
On Apr 17, 2010, at 11:09 AM, Eric Casteleijn wrote: On 04/16/2010 04:46 AM, wolfgang haefelinger wrote: Thanks Robert for your answer. However, it is not exactly what I was looking for (due to my inappropriate problem description). Firstly, I do want to have the document instead of the

Re: getting most recent doc

2010-04-19 Thread Adam Kocoloski
On Apr 19, 2010, at 10:43 AM, Eric Casteleijn wrote: On 04/19/2010 10:22 AM, Adam Kocoloski wrote: On Apr 19, 2010, at 10:10 AM, Eric Casteleijn wrote: I still wonder in that case if there is something you can do to shrink the stored views somewhat: gwibber had a number of views that

Re: getting most recent doc

2010-04-17 Thread Simon Metson
Hi, If your timestamp is the time couchdb gets the document could you possibly ditch the view and just use _changes? Cheers Simon On 16 Apr 2010, at 09:46, wolfgang haefelinger wrote: Thanks Robert for your answer. However, it is not exactly what I was looking for (due to my inappropriate

Re: getting most recent doc

2010-04-17 Thread Eric Casteleijn
On 04/16/2010 04:46 AM, wolfgang haefelinger wrote: Thanks Robert for your answer. However, it is not exactly what I was looking for (due to my inappropriate problem description). Firstly, I do want to have the document instead of the time stamp in order to avoid that additional document

Re: getting most recent doc

2010-04-16 Thread wolfgang haefelinger
Thanks Robert for your answer. However, it is not exactly what I was looking for (due to my inappropriate problem description). Firstly, I do want to have the document instead of the time stamp in order to avoid that additional document fetch. That's obviously easy to fix: function(doc) { //

getting most recent doc

2010-04-15 Thread wolfgang haefelinger
My apologies for asking a probably rather stupid question .. Docs in my database are events. An event has a category name, a time stamp and lots of other details. I am looking for the most recent event. I started with something like function (doc) { // map emit(doc.name,doc) }

Re: getting most recent doc

2010-04-15 Thread Robert Newson
Something like; map; function(doc) { emit([doc.name, doc.timestamp], null); } no reduce method. with calls like; http://localhost:5984/db/_design/ddoc/_view/view?startkey=[name,{}]endkey=[name]descending=truelimit=1 should get you the latest (highest timestamp) for document with doc.name of