incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sean Copenhaver <sean.copenha...@gmail.com>
Subject Re: view on frequently updated value (active_at timestamp)
Date Wed, 27 Apr 2011 12:45:16 GMT
I believe attachments don't come with the document on a read or write. Also
you could actually use an update function to just update the timestamp and
nothing more.

http://wiki.apache.org/couchdb/Document_Update_Handlers

There is an example "bump-counter" and "in-place" update function in the
wiki article that you may be interested in.

If you separated out the documents (which doesn't seem needed) you can
"link" the documents together with some sort of id. Probably the user name
or doc id of their profile or something. Then your map function could emit a
key something like "[<user id>, <doc type>]". So when you query your view
for a start and end key of the user id you actually get all related
documents.

There is an article or post somewhere that gives an example of this, but I
just ran out of time and have to go to a meeting.

On Wed, Apr 27, 2011 at 8:22 AM, Mage <mage@mage.hu> wrote:

>        Hello,
>
> I would like to migrate a kind of social site to CouchDB + Rails.
>
> Users have a field called active_at (timestamp). This field gets updated
> on every click (activity). Some features of the site depends heavily on
> this field.
>
> User related documents should be large in CouchDB (containing images)
> and as far as I know CouchDB rewrites the whole document on every
> update. I suppose I should use another document type to keep these
> timestamps since they can get updated several times per minute per user.
>
> However if the timestamps are in another documents how can I use them
> for views, especially for sorting (which is a main feature)?
>
> What is the CouchDB way for this?
>
>        Mage
>
>


-- 
“The limits of language are the limits of one's world. “ -Ludwig von
Wittgenstein

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