Skip to content

Commit 1e88ad4

Browse files
committed
Merge pull request #728
2 parents 8109cb7 + 0d663ce commit 1e88ad4

File tree

2 files changed

+257
-75
lines changed

2 files changed

+257
-75
lines changed

tests/SpecTests/crud/bulkWrite-arrayFilters.json

Lines changed: 84 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"database_name": "crud-tests",
3333
"tests": [
3434
{
35-
"description": "BulkWrite with arrayFilters",
35+
"description": "BulkWrite updateOne with arrayFilters",
3636
"operations": [
3737
{
3838
"name": "bulkWrite",
@@ -53,7 +53,86 @@
5353
}
5454
]
5555
}
56-
},
56+
}
57+
],
58+
"options": {
59+
"ordered": true
60+
}
61+
},
62+
"result": {
63+
"deletedCount": 0,
64+
"insertedCount": 0,
65+
"insertedIds": {},
66+
"matchedCount": 1,
67+
"modifiedCount": 1,
68+
"upsertedCount": 0,
69+
"upsertedIds": {}
70+
}
71+
}
72+
],
73+
"expectations": [
74+
{
75+
"command_started_event": {
76+
"command": {
77+
"update": "test",
78+
"updates": [
79+
{
80+
"q": {},
81+
"u": {
82+
"$set": {
83+
"y.$[i].b": 2
84+
}
85+
},
86+
"arrayFilters": [
87+
{
88+
"i.b": 3
89+
}
90+
]
91+
}
92+
],
93+
"ordered": true
94+
},
95+
"command_name": "update",
96+
"database_name": "crud-tests"
97+
}
98+
}
99+
],
100+
"outcome": {
101+
"collection": {
102+
"data": [
103+
{
104+
"_id": 1,
105+
"y": [
106+
{
107+
"b": 2
108+
},
109+
{
110+
"b": 1
111+
}
112+
]
113+
},
114+
{
115+
"_id": 2,
116+
"y": [
117+
{
118+
"b": 0
119+
},
120+
{
121+
"b": 1
122+
}
123+
]
124+
}
125+
]
126+
}
127+
}
128+
},
129+
{
130+
"description": "BulkWrite updateMany with arrayFilters",
131+
"operations": [
132+
{
133+
"name": "bulkWrite",
134+
"arguments": {
135+
"requests": [
57136
{
58137
"name": "updateMany",
59138
"arguments": {
@@ -79,8 +158,8 @@
79158
"deletedCount": 0,
80159
"insertedCount": 0,
81160
"insertedIds": {},
82-
"matchedCount": 3,
83-
"modifiedCount": 3,
161+
"matchedCount": 2,
162+
"modifiedCount": 2,
84163
"upsertedCount": 0,
85164
"upsertedIds": {}
86165
}
@@ -92,19 +171,6 @@
92171
"command": {
93172
"update": "test",
94173
"updates": [
95-
{
96-
"q": {},
97-
"u": {
98-
"$set": {
99-
"y.$[i].b": 2
100-
}
101-
},
102-
"arrayFilters": [
103-
{
104-
"i.b": 3
105-
}
106-
]
107-
},
108174
{
109175
"q": {},
110176
"u": {
@@ -134,7 +200,7 @@
134200
"_id": 1,
135201
"y": [
136202
{
137-
"b": 2
203+
"b": 3
138204
},
139205
{
140206
"b": 2

0 commit comments

Comments
 (0)