I need to recreate a document in CouchDB. I use nano
package, but I think the problem is the same with API calls.
What I'm currently doing is to make two calls:
await dbHandle.bulk({docs: [{_id: "abc", _rev: "12-aaaa", _deleted: true}]});
await dbHandle.bulk({docs: [{_id: "abc", content: "...."}]});
But if I combine the two calls into one, the creation gives conflict:
await dbHandle.bulk({docs: [{_id: "abc", _rev: "12-aaaa", _deleted: true},
{_id: "abc", content: "...."}]});
But shouldn't the document be created with a different _rev
value, so no conflict?
I agree that the difference between the two methods is minor, but I want to understand how deletions are synchronized. I have few problems during testing that seems caused by delete operations continuing in background somehow. Sure I'm doing something wrong, but I need to be sure.
Thanks for enlighten me!
mario