Document conflict error while updating design document in couchDB

I am extracting a project document from the "mytest" database on the DB couch, but I want to load the same project document on another db, say, "food".

The command I use to get the project document:

curl http://localhost:5984/mytest/_design/unique > unique.json

and I get a document that looks like this:

{"_id":"_design/unique","_rev":"5-e91630ccf1de8b5784333ea24ce50087","views":{"handle":{"map":"function(doc) {emit(doc.user.id, 1);}","reduce":"function(key, values) {return sum(values);}"},"coordinates":{"map":"function(doc) {\nif((doc.coordinates.coordinates[0] < 145.81) && (doc.coordinates.coordinates[0] > 144.28)\n\t&& (doc.coordinates.coordinates[1] < (-37.47)) && (doc.coordinates.coordinates[1] > (-38.44)))\nemit(doc, 1);\n\n}"}},"language":"javascript"}

but when I upload the same project file to the product database using:

curl -X PUT http://localhost:5984/food/_design/unique -d @unique.json

I get {"error": "conflict", "reason": "Document update failed." }. Could you help me solve this error? I cannot understand his concept of version numbers and how we can put this file in the database.

Thank!

+4
source share
1

, . , - . HTTP- HEAD food, . HEAD , ( ETag ). . API: https://wiki.apache.org/couchdb/HTTP_Document_API

+7

All Articles