I am fetching a design document from "mytest" database on couch DB, but i want to upload the same design document on a different db, lets say "food".
Command which i am using to fetch the design document is :
curl http://localhost:5984/mytest/_design/unique > unique.json
and i get a document which looks like:
{"_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 am uploading the same design file on food database using :
curl -X PUT http://localhost:5984/food/_design/unique -d @unique.json
I get {"error":"conflict","reason":"Document update conflict."} error. Could you please help me to resolve this error? I am not able to understand he concept of revision numbers and how we can actually put this file onto the database.
Thank you!!