I am aware that CouchDB identifies documents that are in conflict after replication. Does CouchDB handle conflict detection differently for _design documents than it does for regular documents? For example, I modify a _design document in DB1. I then modify the same _design document in DB2. I then replicate DB1 to DB2. I would expect that CouchDB identify a conflict, however after replication, Couch returns no conflicts.
Design documents are exactly like normal documents, hence the name "design documents" instead of "couch programs" or such.
If you make identical modifications to identical documents in different databases, you will have no conflicts. Running couchapp push
could create this situation, if you push the same app to two different databases (and they had the same _rev
to begin with).
Otherwise, you will get a conflict, whether design document or no. Of course, couch will "promote" one revision as the canonical version, but if you check for _conflicts
in a view, you will see them. (To see design documents in a view, you must also enable the include_design
option.)
{ "_id": "_design/example"
, "views":
{ "conflicts":
{ "options": {"include_design": true}
, "map": "function(doc) { if(doc._conflicts) emit(doc._id, doc._conflicts); }"
}
}
}
Find conflicting ddocs using a key range scan:
?startkey="_design/"&endkey="_design0"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With