When trying to update the same document concurrently with N1QL I get the following error:
DML Error, possible causes include CAS mismatch or concurrent modificationFailed to perform update - cause: MCResponse status=KEY_EEXISTS, opcode=SET, opaque=0, msg: Data exists for key
This happens on both Couchbase Server 4.0 Enterprise and Couchbase Server 4.1 Enterprise.
This can happen when multiple clients try to update the value of the same document. An update operation on the query engine involves a read followed by a write. If another client thread happens to race and modify the value of the document in between the read - write cycle of the first operation then it would fail with this error.