couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Devendra Gera <>
Subject Document update notifications
Date Wed, 08 Apr 2009 11:05:46 GMT


This is my first message to this mailing list. Please direct me to the
right place if this isn't it.

We are planning to use CouchDB as a central store for objects which also
need to be pushed to various nodes. These nodes get the objects, work on
them and then update them at the central store again. The distribution
and nodes is being handled by a queueing solution.

In order to achieve a single-step publish process, I wanted a hook into
CouchDB whenever a document is created, updated or deleted. The hook
would then push the object into the queue. Also, when a document changes
(we look at a particular "status" field, but it could be any change), we
wanted a hook to send out a notification to a destination specified
within the object.

I looked at the "update_notification" hook and while it was interesting,
it did not allow me to see the actual change in the document. So I went
ahead and implemented a "doc_update_notification" which is extremely
similar to the update_notification, but sends the old as well as the new
doc as part of the notification. Note that it sends *only* bodies by

The patch for 0.9 is available at :

And the patch for 0.8.1 is available at :

The patches are small and simple. I would appreciate any comments. I
suppose the doc update notifications should be No-Ops if one does not
want them. Right now, for example, a doc delete would always result in a
doc retrieval because it has to be sent in a notification. This is true
even when one doesn't have doc update notifications enabled. If someone
is interested, I will work towards making that possible, making it a
generic solution.


View raw message