Skip to content

Update Updates.set to allow Bson value argument#1493

Merged
rozza merged 2 commits intomongodb:mainfrom
tyilo:patch-1
Sep 24, 2025
Merged

Update Updates.set to allow Bson value argument#1493
rozza merged 2 commits intomongodb:mainfrom
tyilo:patch-1

Conversation

@tyilo
Copy link
Copy Markdown
Contributor

@tyilo tyilo commented Sep 6, 2024

No description provided.

@rozza
Copy link
Copy Markdown
Member

rozza commented Sep 23, 2024

Hi @tyilo thanks for the PR.

I have added a Jira ticket JAVA-5620 to track this improvement request. It will be triaged in due course.

Cheers,

Ross

@jyemin jyemin marked this pull request as draft November 18, 2024 21:58
@jyemin jyemin added the external label Feb 4, 2025
@jyemin jyemin marked this pull request as ready for review February 4, 2025 19:57
@atandon2024
Copy link
Copy Markdown

@tyilo Could you please give us more context on why this is important? We believe our API currently fully supports the $set syntax. Could you give us more examples and why this new method makes things better than the existing API?

@tyilo
Copy link
Copy Markdown
Contributor Author

tyilo commented Sep 9, 2025

This matches the current setOnInsert function which is also overloaded.

@rozza rozza self-requested a review September 23, 2025 13:42
@rozza
Copy link
Copy Markdown
Member

rozza commented Sep 23, 2025

I'm inclined to agree that for setting multiple values a Bson object may be helpful.

Could you add a test case to: UpdatesSpecification - something on the lines of:

toBson(set(parse('{ a : 1, b: "two"}'))) == parse('{$set : {a: 1, b: "two"} }')

Copy link
Copy Markdown
Member

@rozza rozza left a comment

Choose a reason for hiding this comment

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

See previous comment - needs a regression test.

@tyilo tyilo requested a review from a team as a code owner September 24, 2025 07:11
@tyilo tyilo requested review from stIncMale and removed request for a team September 24, 2025 07:11
Copy link
Copy Markdown
Member

@rozza rozza left a comment

Choose a reason for hiding this comment

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

LGTM!

@rozza rozza merged commit ff9355f into mongodb:main Sep 24, 2025
4 of 5 checks passed
@rozza
Copy link
Copy Markdown
Member

rozza commented Sep 24, 2025

Many thanks @tyilo for the PR - this has been merged and will be released in the next minor release (5.7.0).

@tyilo tyilo deleted the patch-1 branch September 24, 2025 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants