Skip to content

DRIVERS-3139: Revise assertion for unacknowledged client bulkWrite result #1772

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

Merged
merged 1 commit into from
Mar 21, 2025

Conversation

jmikola
Copy link
Member

@jmikola jmikola commented Mar 19, 2025

https://jira.mongodb.org/browse/DRIVERS-3139

This makes the assertion consistent with collection bulkWrites by allowing for an entirely optional result and conditionally checking acknowledged=false.

Please complete the following before merging:

  • Update changelog.
  • Test changes in at least one language driver.
  • Test these changes against all server versions and topologies (including standalone, replica set, sharded clusters, and serverless).

…sult

This makes the assertion consistent with collection bulkWrites by allowing for an entirely optional result and conditionally checking acknowledged=false.
@jmikola jmikola requested a review from isabelatkinson March 19, 2025 20:07
@jmikola jmikola requested a review from a team as a code owner March 19, 2025 20:07
@jmikola jmikola requested review from alcaeus and removed request for a team March 19, 2025 20:07
deletedCount: { $$unsetOrMatches: 0 }
insertResults: { $$unsetOrMatches: {} }
updateResults: { $$unsetOrMatches: {} }
deleteResults: { $$unsetOrMatches: {} }
Copy link
Member Author

Choose a reason for hiding this comment

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

I decided to leave these additional assertions in place, but I'll note they were never included in the legacy bulkWrite tests (example).

It seemed more important to just allow for an entirely optional result and conditionally check acknowledged.

@kevinAlbs kevinAlbs self-requested a review March 20, 2025 14:46
Copy link
Contributor

@kevinAlbs kevinAlbs left a comment

Choose a reason for hiding this comment

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

Test passes in C driver: https://spruce.mongodb.com/version/67dc28318e83830007a19d14

C driver tests pass before this change. I expect this is due to the C driver test runner representing an unacknowledged result as an empty BSON document. The match of {} against { "insertedCount": { "$$unsetOrMatches": 0 } , ... } passes.

@jmikola jmikola merged commit 7891688 into mongodb:master Mar 21, 2025
5 checks passed
@jmikola jmikola deleted the drivers-3139 branch March 21, 2025 13:56
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.

4 participants