Skip to content

Commit 96caeef

Browse files
authored
DRIVERS-2192 Fix comment helper specification tests (#1137)
1 parent 71c67c0 commit 96caeef

File tree

6 files changed

+81
-94
lines changed

6 files changed

+81
-94
lines changed

source/crud/tests/unified/bulkWrite-comment.json

Lines changed: 27 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@
8888
"_id": 2
8989
},
9090
"update": {
91-
"x": "updated"
91+
"$set": {
92+
"x": "updated"
93+
}
9294
}
9395
}
9496
},
@@ -106,7 +108,9 @@
106108
"deletedCount": 1,
107109
"insertedCount": 1,
108110
"insertedIds": {
109-
"0": 5
111+
"$$unsetOrMatches": {
112+
"0": 5
113+
}
110114
},
111115
"matchedCount": 2,
112116
"modifiedCount": 2,
@@ -147,24 +151,15 @@
147151
"_id": 1,
148152
"x": "replaced"
149153
}
150-
}
151-
],
152-
"ordered": true,
153-
"comment": "comment"
154-
}
155-
}
156-
},
157-
{
158-
"commandStartedEvent": {
159-
"command": {
160-
"update": "BulkWrite_comment",
161-
"updates": [
154+
},
162155
{
163156
"q": {
164157
"_id": 2
165158
},
166159
"u": {
167-
"x": "updated"
160+
"$set": {
161+
"x": "updated"
162+
}
168163
}
169164
}
170165
],
@@ -181,7 +176,8 @@
181176
{
182177
"q": {
183178
"_id": 3
184-
}
179+
},
180+
"limit": 1
185181
}
186182
],
187183
"ordered": true,
@@ -255,7 +251,9 @@
255251
"_id": 2
256252
},
257253
"update": {
258-
"x": "updated"
254+
"$set": {
255+
"x": "updated"
256+
}
259257
}
260258
}
261259
},
@@ -275,7 +273,9 @@
275273
"deletedCount": 1,
276274
"insertedCount": 1,
277275
"insertedIds": {
278-
"0": 5
276+
"$$unsetOrMatches": {
277+
"0": 5
278+
}
279279
},
280280
"matchedCount": 2,
281281
"modifiedCount": 2,
@@ -318,26 +318,15 @@
318318
"_id": 1,
319319
"x": "replaced"
320320
}
321-
}
322-
],
323-
"ordered": true,
324-
"comment": {
325-
"key": "value"
326-
}
327-
}
328-
}
329-
},
330-
{
331-
"commandStartedEvent": {
332-
"command": {
333-
"update": "BulkWrite_comment",
334-
"updates": [
321+
},
335322
{
336323
"q": {
337324
"_id": 2
338325
},
339326
"u": {
340-
"x": "updated"
327+
"$set": {
328+
"x": "updated"
329+
}
341330
}
342331
}
343332
],
@@ -356,7 +345,8 @@
356345
{
357346
"q": {
358347
"_id": 3
359-
}
348+
},
349+
"limit": 1
360350
}
361351
],
362352
"ordered": true,
@@ -432,7 +422,9 @@
432422
"_id": 2
433423
},
434424
"update": {
435-
"x": "updated"
425+
"$set": {
426+
"x": "updated"
427+
}
436428
}
437429
}
438430
},

source/crud/tests/unified/bulkWrite-comment.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ tests:
4848
- updateOne:
4949
filter: &updateOne_filter
5050
_id: 2
51-
update: &update { x: "updated" }
51+
update: &update { $set: {x: "updated"} }
5252
- deleteOne:
5353
filter: &deleteOne_filter
5454
_id: 3
5555
comment: &string_comment "comment"
5656
expectResult: &expect_results
5757
deletedCount: 1
5858
insertedCount: 1
59-
insertedIds: { 0: 5 }
59+
insertedIds: { $$unsetOrMatches: { 0: 5} }
6060
matchedCount: 2
6161
modifiedCount: 2
6262
upsertedCount: 0
@@ -77,12 +77,6 @@ tests:
7777
updates:
7878
- q: *replaceOne_filter
7979
u: *replacement
80-
ordered: true
81-
comment: *string_comment
82-
- commandStartedEvent:
83-
command:
84-
update: *collection_name
85-
updates:
8680
- q: *updateOne_filter
8781
u: *update
8882
ordered: true
@@ -92,6 +86,7 @@ tests:
9286
delete: *collection_name
9387
deletes:
9488
- q: *deleteOne_filter
89+
limit: 1
9590
ordered: true
9691
comment: *string_comment
9792
outcome: &outcome
@@ -133,12 +128,6 @@ tests:
133128
updates:
134129
- q: *replaceOne_filter
135130
u: *replacement
136-
ordered: true
137-
comment: *document_comment
138-
- commandStartedEvent:
139-
command:
140-
update: *collection_name
141-
updates:
142131
- q: *updateOne_filter
143132
u: *update
144133
ordered: true
@@ -148,6 +137,7 @@ tests:
148137
delete: *collection_name
149138
deletes:
150139
- q: *deleteOne_filter
140+
limit: 1
151141
ordered: true
152142
comment: *document_comment
153143
outcome: *outcome

source/crud/tests/unified/updateMany-comment.json

Lines changed: 27 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,11 @@
5353
"filter": {
5454
"_id": 1
5555
},
56-
"update": [
57-
{
58-
"$set": {
59-
"x": 22
60-
}
56+
"update": {
57+
"$set": {
58+
"x": 22
6159
}
62-
],
60+
},
6361
"comment": "comment"
6462
}
6563
}
@@ -77,13 +75,12 @@
7775
"q": {
7876
"_id": 1
7977
},
80-
"u": [
81-
{
82-
"$set": {
83-
"x": 22
84-
}
78+
"u": {
79+
"$set": {
80+
"x": 22
8581
}
86-
]
82+
},
83+
"multi": true
8784
}
8885
],
8986
"comment": "comment"
@@ -121,13 +118,11 @@
121118
"filter": {
122119
"_id": 1
123120
},
124-
"update": [
125-
{
126-
"$set": {
127-
"x": 22
128-
}
121+
"update": {
122+
"$set": {
123+
"x": 22
129124
}
130-
],
125+
},
131126
"comment": {
132127
"key": "value"
133128
}
@@ -147,13 +142,12 @@
147142
"q": {
148143
"_id": 1
149144
},
150-
"u": [
151-
{
152-
"$set": {
153-
"x": 22
154-
}
145+
"u": {
146+
"$set": {
147+
"x": 22
155148
}
156-
]
149+
},
150+
"multi": true
157151
}
158152
],
159153
"comment": {
@@ -193,13 +187,11 @@
193187
"filter": {
194188
"_id": 1
195189
},
196-
"update": [
197-
{
198-
"$set": {
199-
"x": 22
200-
}
190+
"update": {
191+
"$set": {
192+
"x": 22
201193
}
202-
],
194+
},
203195
"comment": "comment"
204196
},
205197
"expectError": {
@@ -220,13 +212,12 @@
220212
"q": {
221213
"_id": 1
222214
},
223-
"u": [
224-
{
225-
"$set": {
226-
"x": 22
227-
}
215+
"u": {
216+
"$set": {
217+
"x": 22
228218
}
229-
]
219+
},
220+
"multi": true
230221
}
231222
],
232223
"comment": "comment"

source/crud/tests/unified/updateMany-comment.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ tests:
2929
object: *collection0
3030
arguments:
3131
filter: &filter { _id: 1 }
32-
update: &update
33-
- $set: { x: 22 }
32+
update: &update { $set: {x: 22} }
3433
comment: "comment"
3534
expectEvents:
3635
- client: *client0
@@ -42,6 +41,7 @@ tests:
4241
-
4342
q: *filter
4443
u: *update
44+
multi: true
4545
comment: "comment"
4646
outcome: &outcome
4747
- collectionName: *collection0Name
@@ -69,6 +69,7 @@ tests:
6969
-
7070
q: *filter
7171
u: *update
72+
multi: true
7273
comment: *comment
7374
outcome: *outcome
7475

@@ -94,5 +95,6 @@ tests:
9495
-
9596
q: *filter
9697
u: *update
98+
multi: true
9799
comment: "comment"
98100
outcome: *initialData

0 commit comments

Comments
 (0)