incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From J Chris Anderson <jch...@gmail.com>
Subject Re: automatic timestamps
Date Thu, 10 Jun 2010 14:35:49 GMT

On Jun 10, 2010, at 7:34 AM, Laura Hamel wrote:

> Hey Couch-Users!
> 
> How do you guys handle timestamping documents?
> 
> I have seen some advice to generate the timestamps in the application.  However, this
has the drawback that multiple applications touching the same database may generate inconsistent
timestamps.  Validation might be able to reject updates when applications submit timestamps
which are too un-synchronized, but this seems like a weird way to solve the problem.  I found
the documentation on using Document Update Handlers (http://wiki.apache.org/couchdb/Document_Update_Handlers)
however these have to be triggered separately.  I'm also not clear on how to trigger that
update through jcouchdb.
> 
> Is there a way to trigger the timestamp to be added automatically when the document is
created?
> 

The document update handler is the proper way to do this. We can't have hooks on document
create or update, because then the timestamp would get changed every time the doc is replicated,
as replication is just another client.

Chris

> Thanks,
> Laura
> 
> -- 
> Laura Hamel
> Software Engineer
> Soar Technology
> lhamel@soartech.com
> 


Mime
View raw message