mongodb / specifications

Specifications related to MongoDB
http://specifications.readthedocs.io/en/latest
Other
389 stars 242 forks source link

DRIVERS-2993 specify behavior of `w:0` with `MongoClient.bulkWrite` #1670

Closed kevinAlbs closed 2 weeks ago

kevinAlbs commented 2 weeks ago

Summary

Specify behavior with unacknowledged writes for MongoClient.bulkWrite:

Existing spec and prose tests using MongoClient.bulkWrite with unacknowledged write concern have been updated to use ordered: false. The default (ordered: true) is now expected to result in a client-side error.

Background & Motivation

See DRIVERS-2993 for motivation.

This PR expects the OP_MSG moreToCome bit is always set for all batches. This agrees with OP_MSG:

Clients doing unacknowledged writes MUST set the moreToCome flag, and MUST set the writeConcern to w=0.

Prose Test

A CRUD prose test is added to insert 100,001 documents with w:0 write concern to test multi-batch unacknowledged write.

The resulting collection count is checked to ensure the unacknowledged writes completes and avoid interfering with later tests. This was similarly done in DRIVERS-2877.

The prose test includes a step to create the collection with the create command as a workaround for SERVER-95537.


Please complete the following before merging:

Tests verified with the C driver in https://github.com/mongodb/mongo-c-driver/pull/1752