I want to update a subset of the fields of an index A and use the optimistic lock functionality of (IncrementSet) to make sure I’m not overwriting newer changes with an older update.
How is the partialUpdateObject function intended to work with the IncrementSet? The documentation only shows updating a single attribute at a time and never any field other than the optimistic lock field as part of the Increment Set, however, the documentation specifically alludes to the fact that it can be done
" Only the IncrementFrom
and IncrementSet
operations guarantee idempotent record updates. The other built-in operations aren’t idempotent and can cause unexpected side-effects, unless you use them in combination with the idempotent operations"
How do i make this a single idempotent operation?
ObjectID("1234") to Partial.Update(Attribute("name"), "my new name"),
ObjectID("1234") to Partial.IncrementSet(Attribute("hvrChangeOp"), 9)
I can see how to do this via the rest api and it works
curl -X POST \
-H "X-Algolia-API-Key: XXXX" \
-H "X-Algolia-Application-Id: XXXX" \
--data-binary '{"name": "my new name", "hvrChangeOp":{"_operation":"IncrementSet", "value":9} }' \
"https://XXXX.algolia.net/1/indexes/customer/1234/partial"
Thanks in advance