CouchDB throws conflict error after immediate update

I'm using CouchDB 1.5 and trying to fix some values in documents with a rather simple request. I simply get a document, modify a value in it and then put it back immediately. Given that my database has low usage, I don't expect this simple operation to produce a conflict. And yet, the 85 documents belonging to 85 different users all fail to update with conflict errors, with no apparent reasons.

Here's the code I'm using:

var PouchDB = require('pouchdb');  var couchdbUrl = 'https://USER:[email protected]';  var usersDb = new PouchDB(`${couchdbUrl}/_users`, {     skip_setup: true });  usersDb.query('faulty_users/object_username', {     include_docs: true }) .then(function(userDocs) {     userDocs.rows         .forEach(function(userDoc) {             userDb = new PouchDB(`${couchdbUrl}/user%2F${userDoc.doc.hoodieId}`);              userDb.get('accountvalues/default', {                     conflicts: true                 })                 .then((doc) => {                     console.log(doc._id, doc._rev, doc._conflicts);                      doc.values.accountValues.username =^user\//, '');                      userDb.put(doc)                         .catch((e) => {                             console.log(userDoc.doc.hoodieId, e);                         });                 });         }); }); 


Category: couchdb Time: 2016-07-28 Views: 0
Tags: couchdb

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development


Front-end development


development tools

Open Platform

Javascript development

.NET development

cloud computing


Copyright (C), All Rights Reserved.

processed in 0.224 (s). 12 q(s)