incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew Woodward <m...@mattwoodward.com>
Subject Re: First doc in a group?
Date Thu, 11 Nov 2010 21:11:15 GMT
On Thu, Nov 11, 2010 at 12:59 PM, Mike Bannister <mikebannister@gmail.com>wrote:

> I have a set of documents that are related to users in my system and each
> document has a timestamp. What's the CouchDB way of getting the latest
> document for each user?


I'm pretty new to CouchDB as well so take this for what it's worth--in one
of our databases we needed to get the most recent document based on a
timestamp, so we just have a view called "byDate" with the key being the
timestamp, and then we just call the view like this:
http://server/database/_design/designname/_view/byDate?descending=true&limit=1

Not sure that's quite what you're after and might not address the user part
of what you're doing, but hope that helps a bit.

-- 
Matthew Woodward
matt@mattwoodward.com
http://blog.mattwoodward.com
identi.ca / Twitter: @mpwoodward

Please do not send me proprietary file formats such as Word, PowerPoint,
etc. as attachments.
http://www.gnu.org/philosophy/no-word-attachments.html

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message