couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Goodall <>
Subject Avoiding updating a doc's _rev if nothing changed
Date Thu, 15 Oct 2009 14:28:33 GMT

I think this is more of a dev question given that it needs some
knowledge of the deterministic rev algorithm ...

I was just wondering if CouchDB could use the deterministic rev stuff
to avoid writing changes to the database if nothing has actually
changed in the doc that is PUT back (or bulk updated, of course).

The most obvious use case is that it's horrifyingly common for users
to click an HTML form's submit button, instead of using the back
button, when they haven't changed anything. I suspect most
applications do not check if the user made any changes and therefore
end up sending exactly the same data back as an update ...
unnecessarily creating a new document rev, growing the database,
invalidating views, and triggering _changes updates.

CouchDB obviously has to calculate the hash for the new rev anyway, so
perhaps it could compare the new value to the current value, skip it
if it's unchanged and return the current _rev in the response.

Is that feasible? If so, I'll create a ticket for it.

- Matt

View raw message