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

Fix _id field returned for findOneAndReplace and findOneAndUpdate with upsert option #421

Merged
merged 3 commits into from
May 12, 2023

Conversation

maheshrajamani
Copy link
Contributor

@maheshrajamani maheshrajamani commented May 9, 2023

What this PR does:
Fix for Issue #416 and #417, replacement PR for #419
Which issue(s) this PR fixes:
Fixes #416 and #417

Checklist

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

@maheshrajamani maheshrajamani self-assigned this May 9, 2023
@maheshrajamani maheshrajamani mentioned this pull request May 9, 2023
4 tasks
@maheshrajamani maheshrajamani marked this pull request as ready for review May 9, 2023 13:19
@maheshrajamani maheshrajamani requested a review from a team as a code owner May 9, 2023 13:19
Copy link
Contributor

@ivansenic ivansenic left a comment

Choose a reason for hiding this comment

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

Don't have much insight into this part of code in order to review.. Maybe PR title should be improved before merging, so we get meaningful messages in the git history..

shredder().shred(documentUpdaterResponse.document(), readDocument.txnId());

// Have to do this because shredder adds _id field to the document if it doesn't exist
JsonNode updatedDocument = writableShreddedDocument.docJsonNode();
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should improve the shredded document impl and avoid this side effect call?

Copy link
Contributor

Choose a reason for hiding this comment

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

That sounds like a good improvement idea; something that handles insertion and reordering of _id before Shredder gets to deal with it.

I'll create a follow-up issue.

@maheshrajamani maheshrajamani changed the title Fix for Issue #416 and #417 Fix _id field returned for findOneAndReplace and findOneAndUpdate with upsert option May 9, 2023
Copy link
Contributor

@tatu-at-datastax tatu-at-datastax left a comment

Choose a reason for hiding this comment

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

LGTM.

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.

findOneAndReplace upsert not generating _id
3 participants