Not sure what causes this error as i dont use a CAS value for an update when i call the N1QL query to update some tracking information. This query works most of the time but several times it will throw this CasMismatchError and i have no Idea why…
CasMismatchError: cas mismatch
at Object.translateCppError (C:\NodeJsRoot\URLShortTrack\node_modules\couchbase\dist\bindingutilities.js:196:20)
at C:\NodeJsRoot\URLShortTrack\node_modules\couchbase\dist\connection.js:248:54 {
cause: LibcouchbaseError: libcouchbase error 209
at Object.translateCppError (C:\NodeJsRoot\URLShortTrack\node_modules\couchbase\dist\bindingutilities.js:174:21)
at C:\NodeJsRoot\URLShortTrack\node_modules\couchbase\dist\connection.js:248:54 {
code: 209
},
context: QueryErrorContext {
first_error_code: 12009,
first_error_message: 'DML Error, possible causes include CAS mismatchFailed to perform UPDATE - cause: MCResponse status=KEY_EEXISTS, opcode=SET, opaque=8538, msg: ',
statement: 'UPDATE Contacts AS d USE KEYS $1\n' +
' SET e.opened = true FOR e IN d.emails WHEN e.tracking_nbr = $2 AND (e.opened IS NOT VALUED OR e.opened = false) END,\n' +
' e.activityDate = $3 FOR e IN d.emails WHEN e.tracking_nbr = $2 AND (e.opened IS NOT VALUED OR e.opened = false) END,\n' +
' d.metrics.nbr_of_email_opened = d.metrics.nbr_of_email_opened +1 ,\n' +
' d.metrics.nbr_of_unique_email_opened = d.metrics.nbr_of_unique_email_opened +\n' +
' CASE WHEN (ANY e IN d.emails SATISFIES e.tracking_nbr = $2 AND (e.opened IS NOT VALUED OR e.opened = false) END)\n' +
' THEN 1 ELSE 0\n' +
' END\n' +
' WHERE d._type = "email_campaign" AND ANY e IN d.emails SATISFIES e.tracking_nbr = $2 END;',
client_context_id: '091c51dbd924fae1',
parameters: '',
http_response_code: 200,
http_response_body: ''
}
}