You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Michael Beam <mi...@me.com> on 2010/01/24 17:23:21 UTC

Revisions for Created Documents

Hi There,

My application is monitoring the _changes API to update its UI for updated documents. I would also like to take actions in my app for new documents, so I wanted to get the list's opinion on detecting created documents.

Is checking the revision string for the prefix "1-" is a reliable and robust method of recognizing a change as a new document?  Everything in my experience points to yes, but I may be overlooking some subtleties about how that all works.

Thanks!

Mike Beam



Re: Revisions for Created Documents

Posted by Markus Jelsma <ma...@buyways.nl>.
Hi Mike,


This is not completely watertight, especially considering replicating over
documents. In general, all new documents are prefixed with 1- but you can
just as easily add a document and set the _rev manually to a number higher
than 1. Setting _rev to 0 won't do the trick though.

If your scenario doesn't allow for these kind of `features`, you could use
it i guess.


Cheers,

Michael Beam said:
> Hi There,
>
> My application is monitoring the _changes API to update its UI for
> updated documents. I would also like to take actions in my app for new
> documents, so I wanted to get the list's opinion on detecting created
> documents.
>
> Is checking the revision string for the prefix "1-" is a reliable and
> robust method of recognizing a change as a new document?  Everything in
> my experience points to yes, but I may be overlooking some subtleties
> about how that all works.
>
> Thanks!
>
> Mike Beam