...
1description: "insertMany"
2
3schemaVersion: "1.0"
4
5createEntities:
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
21initialData:
22 - collectionName: *collectionName
23 databaseName: *databaseName
24 documents:
25 - { _id: 1, x: 11 }
26
27tests:
28 - description: "A successful insertMany"
29 operations:
30 - name: insertMany
31 object: *collection
32 arguments:
33 documents:
34 - { _id: 2, x: 22 }
35 expectEvents:
36 - client: *client
37 events:
38 - commandStartedEvent:
39 command:
40 insert: *collectionName
41 documents:
42 - { _id: 2, x: 22 }
43 ordered: true
44 commandName: insert
45 databaseName: *databaseName
46 - commandSucceededEvent:
47 reply: { ok: 1, n: 1 }
48 commandName: insert
49
50 - description: "A successful insertMany with write errors"
51 operations:
52 - name: insertMany
53 object: *collection
54 arguments:
55 documents:
56 - { _id: 1, x: 11 }
57 expectError:
58 isClientError: false
59 expectEvents:
60 - client: *client
61 events:
62 - commandStartedEvent:
63 command:
64 insert: *collectionName
65 documents:
66 - { _id: 1, x: 11 }
67 ordered: true
68 commandName: insert
69 databaseName: *databaseName
70 - commandSucceededEvent:
71 reply:
72 ok: 1
73 n: 0
74 # The legacy version of this test included an assertion that writeErrors contained a single document
75 # with index=0, a "code" value, and a non-empty "errmsg". However, writeErrors can contain extra fields
76 # beyond these, and the unified format currently does not permit allowing extra fields in sub-documents,
77 # so those assertions are not present here.
78 writeErrors: { $$type: array }
79 commandName: insert
View as plain text