nModified nMatched

n1ql

#1

How can I detect number of mached and changed documents in an UPDATE statement?

Like mongodb

WriteResult. nMatched

The number of documents selected for update. If the update operation results in no change to the document, e.g. $set expression updates the value to the current value, nMatched can be greater than nModified .

WriteResult. nModified

The number of existing documents updated. If the update/replacement operation results in no change to the document, such as setting the value of the field to its current value, nModified can be less than nMatched .


#2

In the N1QL All matched documents will have mutation. I.e. Even if SET doesn’t change it will do update and included in mutationCount. If you want avoid that you can add additional predicate. cc @keshav_m


#3

So , How can I get nModified? for instance in nodejs sdk there is no field in response

http://docs.couchbase.com/sdk-api/couchbase-node-client-2.5.0/Bucket.N1qlQueryResponse.html
http://docs.couchbase.com/sdk-api/couchbase-node-client-2.5.0/Bucket.N1qlQueryResponse.Meta.html