{ "description": "insertMany", "schemaVersion": "1.0", "runOnRequirements": [ { "minServerVersion": "3.6", "topologies": [ "replicaset" ] } ], "createEntities": [ { "client": { "id": "client0", "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" ] } }, { "database": { "id": "database0", "client": "client0", "databaseName": "retryable-writes-tests" } }, { "collection": { "id": "collection0", "database": "database0", "collectionName": "coll" } } ], "initialData": [ { "collectionName": "coll", "databaseName": "retryable-writes-tests", "documents": [ { "_id": 1, "x": 11 } ] } ], "tests": [ { "description": "InsertMany succeeds after one network error", "operations": [ { "name": "failPoint", "object": "testRunner", "arguments": { "client": "client0", "failPoint": { "configureFailPoint": "onPrimaryTransactionalWrite", "mode": { "times": 1 } } } }, { "object": "collection0", "name": "insertMany", "arguments": { "documents": [ { "_id": 2, "x": 22 }, { "_id": 3, "x": 33 } ], "ordered": true }, "expectResult": { "$$unsetOrMatches": { "insertedIds": { "$$unsetOrMatches": { "0": 2, "1": 3 } } } } } ], "outcome": [ { "collectionName": "coll", "databaseName": "retryable-writes-tests", "documents": [ { "_id": 1, "x": 11 }, { "_id": 2, "x": 22 }, { "_id": 3, "x": 33 } ] } ], "expectEvents": [ { "client": "client0", "events": [ { "commandStartedEvent": { "commandName": "insert", "command": { "txnNumber": { "$$exists": true } } } }, { "commandStartedEvent": { "commandName": "insert", "command": { "txnNumber": { "$$exists": true } } } } ] } ] }, { "description": "InsertMany with unordered execution", "operations": [ { "name": "failPoint", "object": "testRunner", "arguments": { "client": "client0", "failPoint": { "configureFailPoint": "onPrimaryTransactionalWrite", "mode": { "times": 1 } } } }, { "object": "collection0", "name": "insertMany", "arguments": { "documents": [ { "_id": 2, "x": 22 }, { "_id": 3, "x": 33 } ], "ordered": false }, "expectResult": { "$$unsetOrMatches": { "insertedIds": { "$$unsetOrMatches": { "0": 2, "1": 3 } } } } } ], "outcome": [ { "collectionName": "coll", "databaseName": "retryable-writes-tests", "documents": [ { "_id": 1, "x": 11 }, { "_id": 2, "x": 22 }, { "_id": 3, "x": 33 } ] } ], "expectEvents": [ { "client": "client0", "events": [ { "commandStartedEvent": { "commandName": "insert", "command": { "txnNumber": { "$$exists": true } } } }, { "commandStartedEvent": { "commandName": "insert", "command": { "txnNumber": { "$$exists": true } } } } ] } ] }, { "description": "InsertMany fails after multiple network errors", "operations": [ { "name": "failPoint", "object": "testRunner", "arguments": { "client": "client0", "failPoint": { "configureFailPoint": "onPrimaryTransactionalWrite", "mode": "alwaysOn", "data": { "failBeforeCommitExceptionCode": 1 } } } }, { "object": "collection0", "name": "insertMany", "arguments": { "documents": [ { "_id": 2, "x": 22 }, { "_id": 3, "x": 33 }, { "_id": 4, "x": 44 } ], "ordered": true }, "expectError": { "isError": true } } ], "outcome": [ { "collectionName": "coll", "databaseName": "retryable-writes-tests", "documents": [ { "_id": 1, "x": 11 } ] } ] } ] }