mongo-java-driver
mongo-java-driver copied to clipboard
Update Updates.set to allow Bson value argument
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
@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?
This matches the current setOnInsert function which is also overloaded.
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"} }')
Many thanks @tyilo for the PR - this has been merged and will be released in the next minor release (5.7.0).