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

Implement $setOnInsert update operator #219

Closed
tatu-at-datastax opened this issue Mar 2, 2023 · 1 comment · Fixed by #225
Closed

Implement $setOnInsert update operator #219

tatu-at-datastax opened this issue Mar 2, 2023 · 1 comment · Fixed by #225
Assignees

Comments

@tatu-at-datastax
Copy link
Contributor

tatu-at-datastax commented Mar 2, 2023

One more update operator in-scope for first version is $setOnInsert: similar to $set but only applying on actual inserts, not updates.

Expected behavior should be similar to what is shown here:

https://www.mongodb.com/docs/manual/reference/operator/update/setOnInsert/#mongodb-update-up.-setOnInsert

@tatu-at-datastax tatu-at-datastax self-assigned this Mar 2, 2023
@tatu-at-datastax
Copy link
Contributor Author

Note: detection of whether a document to update or insert can be found from ReadAndUpdateOperation;

                  DocumentUpdater.DocumentUpdaterResponse documentUpdaterResponse =
                      documentUpdater().applyUpdates(readDocument.document().deepCopy());
                  final JsonNode originalDocument =
                      readDocument.txnId() == null ? null : readDocument.document();

where missing txnId() indicates a newly inserted document

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

Successfully merging a pull request may close this issue.

1 participant