This only seems to be a problem with old-style write operations (wire_version 0) and not with the new write commands.
We connect to a standalone mongod and use an empty collection.
bulk = collection.initialize_ordered_bulk_op bulk.insert({:a => 1}) bulk.insert({:a => 2}) bulk.execute({:w => 2})
We expect this call to raise a BulkWriteError, and it does. However, if we examine the collection afterwards, it will contain the first document we tried to insert,
{ "a" : 1 }Running the same steps with an unordered bulk op:
bulk = collection.initialize_unordered_bulk_op bulk.insert({:a => 1}) bulk.insert({:a => 2}) bulk.execute({:w => 2})
results in both
{ "a" : 1 }and
{ "a" : 2 }being inserted into the collection.
- related to
-
SERVER-13156 wc validation in shell bulk API is not enforced for 2.2/2.4 servers.
- Closed