| 1 |
description: "updateMany" |
| 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 updateMany" |
| 31 |
operations: |
| 32 |
- name: updateMany |
| 33 |
object: *collection |
| 34 |
arguments: |
| 35 |
filter: { _id: { $gt: 1 } } |
| 36 |
update: { $inc: { x: 1 } } |
| 37 |
expectEvents: |
| 38 |
- client: *client |
| 39 |
events: |
| 40 |
- commandStartedEvent: |
| 41 |
command: |
| 42 |
update: *collectionName |
| 43 |
updates: |
| 44 |
- q: { _id: { $gt: 1 } } |
| 45 |
u: { $inc: { x: 1 } } |
| 46 |
upsert: { $$unsetOrMatches: false } |
| 47 |
multi: true |
| 48 |
ordered: true |
| 49 |
commandName: update |
| 50 |
databaseName: *databaseName |
| 51 |
- commandSucceededEvent: |
| 52 |
reply: { ok: 1, n: 2 } |
| 53 |
commandName: update |
| 54 |
|
| 55 |
- description: "A successful updateMany with write errors" |
| 56 |
operations: |
| 57 |
- name: updateMany |
| 58 |
object: *collection |
| 59 |
arguments: |
| 60 |
filter: { _id: { $gt: 1 } } |
| 61 |
update: { $unsupported: { x: 1 } } |
| 62 |
expectError: |
| 63 |
isClientError: false |
| 64 |
expectEvents: |
| 65 |
- client: *client |
| 66 |
events: |
| 67 |
- commandStartedEvent: |
| 68 |
command: |
| 69 |
update: *collectionName |
| 70 |
updates: |
| 71 |
- q: { _id: { $gt: 1 } } |
| 72 |
u: { $unsupported: { x: 1 } } |
| 73 |
upsert: { $$unsetOrMatches: false } |
| 74 |
multi: true |
| 75 |
ordered: true |
| 76 |
commandName: update |
| 77 |
databaseName: *databaseName |
| 78 |
- commandSucceededEvent: |
| 79 |
reply: |
| 80 |
ok: 1 |
| 81 |
n: 0 |
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
writeErrors: { $$type: array } |
| 87 |
commandName: update |