incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Hahn <m...@boutiquing.com>
Subject Re: How to identify new docs in the _changes feed?
Date Thu, 23 Jun 2011 01:13:39 GMT
> What if revision 2-* replicates in?

I assume you mean: What if revision 2-* replicates in and there is no 1-*?

On Wed, Jun 22, 2011 at 1:26 PM, Randall Leeds <randall.leeds@gmail.com>wrote:

> On Wed, Jun 22, 2011 at 10:17, Jens Alfke <jens@mooseyard.com> 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?
>
> Youisright. But it would work. ;)
>
> >
> > 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.
> >
> > —Jens
>
> Careful, this is not cheap (yet):
> https://issues.apache.org/jira/browse/COUCHDB-941
> (The workaround is be sure to specify ?limit=1 or some similarly
> restrictive query)
>
> Why do you need to know the difference and what defines "created" for you?
> Would a document that replicated from elsewhere count as "created" or
> only if it's the first revision?
> What if revision 2-* replicates in?
>



-- 
Mark Hahn
Website Manager
mark@boutiquing.com
949-342-4246

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message