| 1 |
data: |
| 2 |
- {_id: 1, y: [{b: 3}, {b: 1}]} |
| 3 |
- {_id: 2, y: [{b: 0}, {b: 1}]} |
| 4 |
minServerVersion: '3.5.6' |
| 5 |
|
| 6 |
tests: |
| 7 |
- |
| 8 |
description: "UpdateMany when no documents match arrayFilters" |
| 9 |
operation: |
| 10 |
name: "updateMany" |
| 11 |
arguments: |
| 12 |
filter: {} |
| 13 |
update: |
| 14 |
$set: {"y.$[i].b": 2} |
| 15 |
arrayFilters: |
| 16 |
- {i.b: 4} |
| 17 |
|
| 18 |
outcome: |
| 19 |
result: |
| 20 |
matchedCount: 2 |
| 21 |
modifiedCount: 0 |
| 22 |
upsertedCount: 0 |
| 23 |
collection: |
| 24 |
data: |
| 25 |
- {_id: 1, y: [{b: 3}, {b: 1}]} |
| 26 |
- {_id: 2, y: [{b: 0}, {b: 1}]} |
| 27 |
- |
| 28 |
description: "UpdateMany when one document matches arrayFilters" |
| 29 |
operation: |
| 30 |
name: "updateMany" |
| 31 |
arguments: |
| 32 |
filter: {} |
| 33 |
update: |
| 34 |
$set: {"y.$[i].b": 2} |
| 35 |
arrayFilters: |
| 36 |
- {i.b: 3} |
| 37 |
|
| 38 |
outcome: |
| 39 |
result: |
| 40 |
matchedCount: 2 |
| 41 |
modifiedCount: 1 |
| 42 |
upsertedCount: 0 |
| 43 |
collection: |
| 44 |
data: |
| 45 |
- {_id: 1, y: [{b: 2}, {b: 1}]} |
| 46 |
- {_id: 2, y: [{b: 0}, {b: 1}]} |
| 47 |
- |
| 48 |
description: "UpdateMany when multiple documents match arrayFilters" |
| 49 |
operation: |
| 50 |
name: "updateMany" |
| 51 |
arguments: |
| 52 |
filter: {} |
| 53 |
update: |
| 54 |
$set: {"y.$[i].b": 2} |
| 55 |
arrayFilters: |
| 56 |
- {i.b: 1} |
| 57 |
|
| 58 |
outcome: |
| 59 |
result: |
| 60 |
matchedCount: 2 |
| 61 |
modifiedCount: 2 |
| 62 |
upsertedCount: 0 |
| 63 |
collection: |
| 64 |
data: |
| 65 |
- {_id: 1, y: [{b: 3}, {b: 2}]} |
| 66 |
- {_id: 2, y: [{b: 0}, {b: 2}]} |