couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Candler <>
Subject Re: sample couchdb application
Date Thu, 07 Jan 2010 20:55:45 GMT
On Wed, Jan 06, 2010 at 01:42:56PM -0800, Chris Anderson wrote:
> > emit([
> >   doc.question_created_at,
> >   doc.question_id,
> >  (doc.question) ? 0 : 1], doc)
> That's good. I hadn't thought of that.
> One concern is clock drift between clients. Another is validating that
> the client hasn't changed the question_created_at.

But if you embed the created_at time within the doc's _id, then it can't be
changed. So don't keep a created_at timestamp at all; just use

  algorithm = utc_random

Take the first 14 characters of the _id whenever you want to know the
created_at time.

I haven't been following the details of this thread, but if you have
separate answer documents I think they can have a pointer to the
question_id, which is naturally ordered by date using the utc_random uuid

View raw message