incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jedediah Smith <>
Subject Re: Auto-adding additional fields on PUT/POST? (datetime stamps)
Date Tue, 02 Dec 2008 00:56:40 GMT

The new validation functions might be able to do this for you if they 
are allowed to modify the document. Whether or not they are was asked on 
the dev list but not answered. I hope they are as that would be 
endlessly useful. It would be *really* neat if a function could also 
handle merging for revision conflicts.

Jason Huggins wrote:
> Hello all!
> I would like some meta-data to get inserted into documents when my
> users create them. At a minimum, something like Created and
> LastModified datetime stamps would be nice. Currently, the users have
> to manually add these fields when they POST or PUT. Ideally, there is
> something I can do on the server side to "automagically" add those
> fields for them.
> I think the easiest thing to do is to create a DBNotificationUpdate
> script that looks for new documents and updates them with the datetime
> data as a document revision.
> Is there a better way to handle this? I think I want something like
> what happens now with the creation of the "_id" field... If "_id" is
> missing, CouchDB will add it to the document on the user's behalf at
> document creation time.
> Thanks, and happy couching!
> -jason

View raw message