Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

atomic doesn't update the _rev property in the returned object #210

tciuro opened this Issue Jun 24, 2014 · 2 comments


None yet
2 participants

tciuro commented Jun 24, 2014


Take the following example from the documentation:

db.atomic("update", "inplace", "foobar", {
    field: "foo",
    value: "bar"
}, function(error, response) {
    assert.equal(error, undefined, "failed to update");
    assert.equal(response.foo, "bar", "update worked");

What I see is that once the response is received, the object doesn't contain the updated _rev value. In other words, if the _rev is 1 before calling atomic, the response still contains _rev:1, not _rev:2 as it should. The workaround is to perform another fetch in the atomic callback to retrieve the "real" object, but it's far from ideal.


dscape commented Aug 27, 2014

I think that's how couchdb works, not really nano specific. We just implement a client on top of how couch works, not change its sematics.

Let me know if i can help any further

@dscape dscape closed this Aug 27, 2014

tciuro commented Jul 29, 2015

Nuno, I was looking at the CouchDB docs and in version 2.0 you can see that the response contains the following header property:

X-Couch-Update-NewRev: 12-a5e099df5720988dae90c8b664496baf

Looks like Nano could replace the _rev value with the one provided in the header. That would be great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment