The error returned for a CAS mismatch is the same that is returned when trying to insert an already-existing document. The error code is not ambiguous since the CAS option is only accepted (and only makes sense) for documents which already exist.
Is the above statemat always true? We have KeyExistsError even in delete operation?
Can you (or any body) verify that In couchnode client it is safe to assume CAS mismatch error as a KeyExistsError and the statement is true regardless of operation,insert,upsert,delete,subdoc
This is nearly true. KeyExistsError will appear for insert when they key exists, regardless of any kind of CAS usage, since CAS is ignored on an insert. In the other cases, the KeyExistsError will appear when a CAS mismatch occurs.