On Wed, Jun 22, 2011 at 10:17 AM, Jens Alfke <[email protected]> wrote:
> By watching the _changes feed I can detect when a document is deleted (via 
> the “deleted” key), but is there a way to tell when a new document is 
> created? There doesn’t seem to be a corresponding extra key in the 
> notification in this case.
>
> I am tempted to look for a prefix of “1-“ in the revision, but I’m pretty 
> sure that this is an implementation detail and revision IDs should be treated 
> as purely opaque cookies, amiright?
>
> The cheapest alternative I can think of is to do a HEAD on the _all_docs view 
> after I get a new notification from _changes, and see if its ETag has changed.

I typically have created_at and updated_at (monkey patch couchrest's
save method, assuming you are using ruby) in all of my documents which
makes it easy to know this difference.

K.
---
http://blitz.io
http://twitter.com/pcapr
http://labs.mudynamics.com

Reply via email to