| 1 | description: "bulkWrite" |
| 2 | |
| 3 | schemaVersion: "1.0" |
| 4 | |
| 5 | createEntities: |
| 6 | - client: |
| 7 | id: &client client |
| 8 | observeEvents: |
| 9 | - commandStartedEvent |
| 10 | - commandSucceededEvent |
| 11 | - commandFailedEvent |
| 12 | - database: |
| 13 | id: &database database |
| 14 | client: *client |
| 15 | databaseName: &databaseName command-monitoring-tests |
| 16 | - collection: |
| 17 | id: &collection collection |
| 18 | database: *database |
| 19 | collectionName: &collectionName test |
| 20 | |
| 21 | initialData: |
| 22 | - collectionName: *collectionName |
| 23 | databaseName: *databaseName |
| 24 | documents: |
| 25 | - { _id: 1, x: 11 } |
| 26 | - { _id: 2, x: 22 } |
| 27 | - { _id: 3, x: 33 } |
| 28 | |
| 29 | tests: |
| 30 | - description: "A successful mixed bulk write" |
| 31 | operations: |
| 32 | - name: bulkWrite |
| 33 | object: *collection |
| 34 | arguments: |
| 35 | requests: |
| 36 | - insertOne: |
| 37 | document: { _id: 4, x: 44 } |
| 38 | - updateOne: |
| 39 | filter: { _id: 3 } |
| 40 | update: { $set: { x: 333 } } |
| 41 | expectEvents: |
| 42 | - client: *client |
| 43 | events: |
| 44 | - commandStartedEvent: |
| 45 | command: |
| 46 | insert: *collectionName |
| 47 | documents: |
| 48 | - { _id: 4, x: 44 } |
| 49 | ordered: true |
| 50 | commandName: insert |
| 51 | databaseName: *databaseName |
| 52 | - commandSucceededEvent: |
| 53 | reply: { ok: 1, n: 1 } |
| 54 | commandName: insert |
| 55 | - commandStartedEvent: |
| 56 | command: |
| 57 | update: *collectionName |
| 58 | updates: |
| 59 | - q: {_id: 3 } |
| 60 | u: { $set: { x: 333 } } |
| 61 | upsert: { $$unsetOrMatches: false } |
| 62 | multi: { $$unsetOrMatches: false } |
| 63 | ordered: true |
| 64 | commandName: update |
| 65 | databaseName: *databaseName |
| 66 | - commandSucceededEvent: |
| 67 | reply: { ok: 1, n: 1 } |
| 68 | commandName: update |