couchbaselabs / couchbaselabs/node-ottoman

Is there a way to retrieve the CAS from the document?

Open
#652 7 comments 0 reactions 1 assignee Claimed by @gsi-alejandro View on GitHub
Investigation
Dominant language
TypeScript
Stars
295
Forks
99
PR merge metrics
No merged PRs in 30d

Description

As one of the approaches to concurrency-safe mutating document, I need to get the CAS from the document and replace the doc with it.

I didn't find a documentation about the CAS retrieving, digging into the code it seems the `findById` only gets back the `value`(that is replaced by [content](https://docs.couchbase.com/sdk-api/couchbase-node-client/classes/GetResult.html) according to latest sdk)
https://github.com/couchbaselabs/node-ottoman/blob/d8a4936ed996526735bae3fca478fda1516d582c/src/model/create-model.ts#L190-L192

Will it be a good idea to have the ottoman to support both query CAS and update with it?
my two cents,

* Enhancement on `FindByIdOptions` to allow querying the CAS
* Enhancement on `updateById ` to allow passing a CAS(probably via `MutationFunctionOptions`)?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.