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

Bug fix for upsert if filter is based on non id filter #280

Merged
merged 1 commit into from
Mar 20, 2023

Conversation

maheshrajamani
Copy link
Contributor

@maheshrajamani maheshrajamani commented Mar 20, 2023

What this PR does:
Fix returning upsertedId if the filter is based on non id field.
Which issue(s) this PR fixes:
Fixes #273 and #275

Checklist

  • Changes manually tested
  • Automated Tests added/updated
  • Documentation added/updated
  • CLA Signed: DataStax CLA

@maheshrajamani maheshrajamani marked this pull request as ready for review March 20, 2023 19:26
@maheshrajamani maheshrajamani requested a review from a team as a code owner March 20, 2023 19:26
@maheshrajamani maheshrajamani merged commit bb48523 into main Mar 20, 2023
@maheshrajamani maheshrajamani deleted the fix-upsertedId branch March 20, 2023 20:14
@@ -168,7 +170,7 @@ private Uni<UpdatedDocument> processUpdate(
v -> {
if (readDocument.txnId() != null) modifiedCount.incrementAndGet();
return new UpdatedDocument(
readDocument.id(),
writableShreddedDocument.id(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So how is this a fix and wouldn't this end up in the NPE in that else case? Something is off here..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By default updated Document id (updated) is set as Uni.nullValue() when writableShreddedDocument is null. This handled in the below code as
updated
.onItem()
.ifNotNull()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I adapted this a bit in #281 We need to think about readbility of the code, and in general simplification where possible..

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 this pull request may close these issues.

updateMany 'upsert' flag response fields missing
3 participants