https://learn.microsoft.com/en-us/azure/cosmos-db/partial-document-update#supported-operations
says that I can use "increment" to increment a value in my database, however this code
const operations =
[
{ op: 'increment', path: '/public/inventory/irradish', value: irradish},
{ op: 'increment', path: '/public/inventory/sunmelon', value: sunmelon},
{ op: 'set', path: '/map/garden/lastUse', value: time}
];
const { resource: updated } = await container
.item(
id = email,
partitionKeyValue = email
)
throws this error:
Error: Message: {"Errors":["Invalid value of the patch operation ‘op’ property in patch request: ‘increment’"]}
ActivityId: f1bb8b88-ab68-4f2b-b244-8b021b0d9021,…
How do I increment?
2
Answers
The way to do it is to use "incr" instead of "increment".
I requested the documentation be updated to reflect this.
You need to use "incr" as answered above.
However regarding the documentation,
increment
is just an operation. The samples in the Node SDK repository illustrates how to do increment operation,