incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mage <m...@mage.hu>
Subject Re: view on frequently updated value (active_at timestamp)
Date Sat, 28 May 2011 18:40:09 GMT
        Hello,

I just played with the update handler. It still rewrites the whole
document. It takes too much time since I have to update the document on
user activity.

Separating the data into linked (joined) documents makes impossible to
have multiple key views.

Is there a solution?

        Mage


On 04/27/2011 02:45 PM, Sean Copenhaver wrote:
> 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
>>
>>
>


Mime
View raw message