{ "description": "insertOne", "schemaVersion": "1.0", "createEntities": [ { "client": { "id": "client", "observeEvents": [ "commandStartedEvent", "commandSucceededEvent", "commandFailedEvent" ] } }, { "database": { "id": "database", "client": "client", "databaseName": "command-monitoring-tests" } }, { "collection": { "id": "collection", "database": "database", "collectionName": "test" } } ], "initialData": [ { "collectionName": "test", "databaseName": "command-monitoring-tests", "documents": [ { "_id": 1, "x": 11 } ] } ], "tests": [ { "description": "A successful insertOne", "operations": [ { "name": "insertOne", "object": "collection", "arguments": { "document": { "_id": 2, "x": 22 } } } ], "expectEvents": [ { "client": "client", "events": [ { "commandStartedEvent": { "command": { "insert": "test", "documents": [ { "_id": 2, "x": 22 } ], "ordered": true }, "commandName": "insert", "databaseName": "command-monitoring-tests" } }, { "commandSucceededEvent": { "reply": { "ok": 1, "n": 1 }, "commandName": "insert" } } ] } ] }, { "description": "A successful insertOne with write errors", "operations": [ { "name": "insertOne", "object": "collection", "arguments": { "document": { "_id": 1, "x": 11 } }, "expectError": { "isClientError": false } } ], "expectEvents": [ { "client": "client", "events": [ { "commandStartedEvent": { "command": { "insert": "test", "documents": [ { "_id": 1, "x": 11 } ], "ordered": true }, "commandName": "insert", "databaseName": "command-monitoring-tests" } }, { "commandSucceededEvent": { "reply": { "ok": 1, "n": 0, "writeErrors": { "$$type": "array" } }, "commandName": "insert" } } ] } ] } ] }