Debian Codegraph @

testdata/crud/v1/write/bulkWrite-arrayFilters.yml

raw
1 data:
2 - {_id: 1, y: [{b: 3}, {b: 1}]}
3 - {_id: 2, y: [{b: 0}, {b: 1}]}
4
5 minServerVersion: '3.5.6'
6
7 tests:
8 -
9 description: "BulkWrite with arrayFilters"
10 operation:
11 name: "bulkWrite"
12 arguments:
13 requests:
14 -
15 # UpdateOne when one document matches arrayFilters
16 name: "updateOne"
17 arguments:
18 filter: {}
19 update:
20 $set: {"y.$[i].b": 2}
21 arrayFilters:
22 - {i.b: 3}
23 -
24 # UpdateMany when multiple documents match arrayFilters
25 name: "updateMany"
26 arguments:
27 filter: {}
28 update:
29 $set: {"y.$[i].b": 2}
30 arrayFilters:
31 - {i.b: 1}
32 options: { ordered: true }
33 outcome:
34 result:
35 deletedCount: 0
36 insertedCount: 0
37 insertedIds: {}
38 matchedCount: 3
39 modifiedCount: 3
40 upsertedCount: 0
41 upsertedIds: {}
42 collection:
43 data:
44 - {_id: 1, y: [{b: 2}, {b: 2}]}
45 - {_id: 2, y: [{b: 0}, {b: 2}]}