Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partial Update Object #409

Open
pdavidson opened this issue Oct 31, 2023 · 0 comments
Open

Partial Update Object #409

pdavidson opened this issue Oct 31, 2023 · 0 comments

Comments

@pdavidson
Copy link

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 kotlin implementation of 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 the java 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant