Details
-
Bug
-
Resolution: Won't Fix
-
Major
-
None
-
sdk3.2-backlog
-
DOC-2021-Dec05-S24, DOC-2021-Dec19-S25, DOC-2021-Dec31-S26, DOC-2022-S1, DOC-2022-S2, DOC-2022-S3, DOC-2022-S4, DOC-2022-S5, DOC-2022-S8, DOC-2022-S9
-
1
Description
https://forums.couchbase.com/t/subdoc-on-non-existing-document/19539
A user is trying to mutate fields in a doc that may/may not exist yet. This is the basic scenario:
- mutate fields (if doc exists then everything ok)
- if mutate failed then insert new doc with those fields
We should document this as it seems a useful scenario for users.
In the forum we can see that this has been suggested by Brett:
bucket.mutateIn('mydoc', {upsert: true}) |
.upsert('foo.bar', 10, {createParents: true}) |
.upsert('foo.baz', 20, {createParents: true}) |
.execute((err) => {
|
// Completed! |
});
|
Which seems to be what the user was looking for (also see the linked issue, seems API docs needed to be updated).
Attachments
Issue Links
- relates to
-
JSCBC-529 Missing inline documentation of mutateIn upsert/insert options.
- Resolved