node-ottoman
node-ottoman copied to clipboard
Ottoman.js mutateIn equivalient
In couchbase's NodeJs SDK we have a mutateIn method to update a document, What is equivalent in Ottoman.js ? I want to increment a field (I don't want to use N1QL to have better performance)
await bucket.collection('users')
.mutateIn(user_id, [couchbase.MutateInSpec.increment('counter', 1)])
Hello @sm2017 Ottoman is in alpha and the documentation can be found here Answering to your question, we have updatebyid which allows you to pass in the id as the first param and the field that you want to update here is the documentation
@AV25242 updatebyid cannot increment the value , it just upsert value
@sm2017 its not upsert, if you want an upsert then you will have to use findoneandupdate.
And you are right there is no function yet that can increment a field
It's like mutate in upsert not document upsert like https://docs.couchbase.com/sdk-api/couchbase-node-client/MutateInSpec.html#.upsert