Description
Using the SDK, if you want to provide a serialized `cas`, you cannot pass it directly to a couchbase function :
const result = await cb.collection('my_collection').mutateIn(docKey, [
|
MutateInSpec.replace('someProp', somePropValue),
|
], {
|
cas: CouchbaseCas.from(myCasString), <= I cannot pass a string directly, it requires a object that implements the Cas interface
|
});
|
I've made a quick implementation :
import { Cas } from "couchbase";
|
|
export class CouchbaseCas implements Cas {
|
private readonly cas: string;
|
|
constructor(casString: string) {
|
this.cas = casString;
|
}
|
|
static from(casString: string) {
|
return new CouchbaseCas(casString);
|
}
|
|
toJSON() {
|
return this.cas;
|
}
|
|
toString() {
|
return this.cas;
|
}
|
}
|
It would be nice to provide a default implementation, since virtually all SDK users will need one.
Attachments
Gerrit Reviews
For Gerrit Dashboard: JSCBC-1164 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
197252,7 | JSCBC-1164: Update CAS type on mutation requests to correctly reflect allowed CAS representations | master | couchnode | Status: MERGED | +2 | +1 |