Skip to content

CDRIVER-5969 return NULL result if no writes indicated #1990

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 3 commits into from
Apr 15, 2025

Conversation

kevinAlbs
Copy link
Collaborator

Summary

Return NULL mongoc_bulkwrite_result_t if no server reply indicated writes were attempted.

Verified by this patch build.

Background & Motivation

Quoting Bulk Write spec:

Drivers MUST NOT populate the partialResult field in BulkWriteException if it cannot be determined that at least one write was successfully performed.

The C driver incorrectly assumed the absence of errors indicated a successful write. But a client-side error could be returned before any attempts to send writes.

This PR includes an additional check to ensure an ok:1 server reply was received and parsed to indicate the server attempted writes.

@kevinAlbs kevinAlbs marked this pull request as ready for review April 9, 2025 18:30
@kevinAlbs kevinAlbs requested a review from mdb-ad April 9, 2025 18:31
@kevinAlbs kevinAlbs merged commit 1955cff into mongodb:master Apr 15, 2025
40 of 42 checks passed
kevinAlbs added a commit to kevinAlbs/mongo-c-driver that referenced this pull request Apr 15, 2025
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.

2 participants