incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Anderson" <jch...@apache.org>
Subject Re: Auto-adding additional fields on PUT/POST? (datetime stamps)
Date Wed, 03 Dec 2008 23:01:07 GMT
On Wed, Dec 3, 2008 at 2:50 PM, Antony Blakey <antony.blakey@gmail.com> wrote:
>
> On 04/12/2008, at 9:07 AM, Chris Anderson wrote:
>
>> It should just be clear that timestamps are the application's
>> business, not the database's.
>
> But it's possible for Couch to be the application, especially if you use
> your apps-in-the-db approach. I'm not sure I see any fundamental difference
> between a validation function in a design document and some javascript in an
> attachment, of even a function inan _external handler.
>

The problem with writing from the validation functions is that you are
supposed to be able to trust them. Eg, if you look at the function,
you can know what contract holds on the data that passes through it. A
timestamp on new docs doesn't pass this test. There's no way to know
whether the timestamp was added by a different function. With proper
pass/fail validations, you know that running the same validations at
replication time will give the same pass/fail result as at original
write time.

It's nice that _external will be in trunk and available for this sort
of thing. (Application in the db.)

-- 
Chris Anderson
http://jchris.mfdz.com

Mime
View raw message