1{
2 "description": "findOneAndReplace-dots_and_dollars",
3 "schemaVersion": "1.0",
4 "createEntities": [
5 {
6 "client": {
7 "id": "client0",
8 "observeEvents": [
9 "commandStartedEvent"
10 ]
11 }
12 },
13 {
14 "database": {
15 "id": "database0",
16 "client": "client0",
17 "databaseName": "crud-tests"
18 }
19 },
20 {
21 "collection": {
22 "id": "collection0",
23 "database": "database0",
24 "collectionName": "coll0"
25 }
26 }
27 ],
28 "initialData": [
29 {
30 "collectionName": "coll0",
31 "databaseName": "crud-tests",
32 "documents": [
33 {
34 "_id": 1
35 }
36 ]
37 }
38 ],
39 "tests": [
40 {
41 "description": "Replacing document with top-level dotted key on 3.6+ server",
42 "runOnRequirements": [
43 {
44 "minServerVersion": "3.6"
45 }
46 ],
47 "operations": [
48 {
49 "name": "findOneAndReplace",
50 "object": "collection0",
51 "arguments": {
52 "filter": {
53 "_id": 1
54 },
55 "replacement": {
56 "_id": 1,
57 "a.b": 1
58 }
59 },
60 "expectResult": {
61 "_id": 1
62 }
63 }
64 ],
65 "expectEvents": [
66 {
67 "client": "client0",
68 "events": [
69 {
70 "commandStartedEvent": {
71 "command": {
72 "findAndModify": "coll0",
73 "query": {
74 "_id": 1
75 },
76 "update": {
77 "_id": 1,
78 "a.b": 1
79 },
80 "new": {
81 "$$unsetOrMatches": false
82 }
83 }
84 }
85 }
86 ]
87 }
88 ],
89 "outcome": [
90 {
91 "collectionName": "coll0",
92 "databaseName": "crud-tests",
93 "documents": [
94 {
95 "_id": 1,
96 "a.b": 1
97 }
98 ]
99 }
100 ]
101 },
102 {
103 "description": "Replacing document with top-level dotted key on pre-3.6 server yields server-side error",
104 "runOnRequirements": [
105 {
106 "maxServerVersion": "3.4.99"
107 }
108 ],
109 "operations": [
110 {
111 "name": "findOneAndReplace",
112 "object": "collection0",
113 "arguments": {
114 "filter": {
115 "_id": 1
116 },
117 "replacement": {
118 "_id": 1,
119 "a.b": 1
120 }
121 },
122 "expectError": {
123 "isClientError": false
124 }
125 }
126 ],
127 "expectEvents": [
128 {
129 "client": "client0",
130 "events": [
131 {
132 "commandStartedEvent": {
133 "command": {
134 "findAndModify": "coll0",
135 "query": {
136 "_id": 1
137 },
138 "update": {
139 "_id": 1,
140 "a.b": 1
141 },
142 "new": {
143 "$$unsetOrMatches": false
144 }
145 }
146 }
147 }
148 ]
149 }
150 ],
151 "outcome": [
152 {
153 "collectionName": "coll0",
154 "databaseName": "crud-tests",
155 "documents": [
156 {
157 "_id": 1
158 }
159 ]
160 }
161 ]
162 },
163 {
164 "description": "Replacing document with dollar-prefixed key in embedded doc on 5.0+ server",
165 "runOnRequirements": [
166 {
167 "minServerVersion": "5.0"
168 }
169 ],
170 "operations": [
171 {
172 "name": "findOneAndReplace",
173 "object": "collection0",
174 "arguments": {
175 "filter": {
176 "_id": 1
177 },
178 "replacement": {
179 "_id": 1,
180 "a": {
181 "$b": 1
182 }
183 }
184 },
185 "expectResult": {
186 "_id": 1
187 }
188 }
189 ],
190 "expectEvents": [
191 {
192 "client": "client0",
193 "events": [
194 {
195 "commandStartedEvent": {
196 "command": {
197 "findAndModify": "coll0",
198 "query": {
199 "_id": 1
200 },
201 "update": {
202 "_id": 1,
203 "a": {
204 "$b": 1
205 }
206 },
207 "new": {
208 "$$unsetOrMatches": false
209 }
210 }
211 }
212 }
213 ]
214 }
215 ],
216 "outcome": [
217 {
218 "collectionName": "coll0",
219 "databaseName": "crud-tests",
220 "documents": [
221 {
222 "_id": 1,
223 "a": {
224 "$b": 1
225 }
226 }
227 ]
228 }
229 ]
230 },
231 {
232 "description": "Replacing document with dollar-prefixed key in embedded doc on pre-5.0 server yields server-side error",
233 "runOnRequirements": [
234 {
235 "maxServerVersion": "4.99"
236 }
237 ],
238 "operations": [
239 {
240 "name": "findOneAndReplace",
241 "object": "collection0",
242 "arguments": {
243 "filter": {
244 "_id": 1
245 },
246 "replacement": {
247 "_id": 1,
248 "a": {
249 "$b": 1
250 }
251 }
252 },
253 "expectError": {
254 "isClientError": false
255 }
256 }
257 ],
258 "expectEvents": [
259 {
260 "client": "client0",
261 "events": [
262 {
263 "commandStartedEvent": {
264 "command": {
265 "findAndModify": "coll0",
266 "query": {
267 "_id": 1
268 },
269 "update": {
270 "_id": 1,
271 "a": {
272 "$b": 1
273 }
274 },
275 "new": {
276 "$$unsetOrMatches": false
277 }
278 }
279 }
280 }
281 ]
282 }
283 ],
284 "outcome": [
285 {
286 "collectionName": "coll0",
287 "databaseName": "crud-tests",
288 "documents": [
289 {
290 "_id": 1
291 }
292 ]
293 }
294 ]
295 },
296 {
297 "description": "Replacing document with dotted key in embedded doc on 3.6+ server",
298 "runOnRequirements": [
299 {
300 "minServerVersion": "3.6"
301 }
302 ],
303 "operations": [
304 {
305 "name": "findOneAndReplace",
306 "object": "collection0",
307 "arguments": {
308 "filter": {
309 "_id": 1
310 },
311 "replacement": {
312 "_id": 1,
313 "a": {
314 "b.c": 1
315 }
316 }
317 },
318 "expectResult": {
319 "_id": 1
320 }
321 }
322 ],
323 "expectEvents": [
324 {
325 "client": "client0",
326 "events": [
327 {
328 "commandStartedEvent": {
329 "command": {
330 "findAndModify": "coll0",
331 "query": {
332 "_id": 1
333 },
334 "update": {
335 "_id": 1,
336 "a": {
337 "b.c": 1
338 }
339 },
340 "new": {
341 "$$unsetOrMatches": false
342 }
343 }
344 }
345 }
346 ]
347 }
348 ],
349 "outcome": [
350 {
351 "collectionName": "coll0",
352 "databaseName": "crud-tests",
353 "documents": [
354 {
355 "_id": 1,
356 "a": {
357 "b.c": 1
358 }
359 }
360 ]
361 }
362 ]
363 },
364 {
365 "description": "Replacing document with dotted key in embedded doc on pre-3.6 server yields server-side error",
366 "runOnRequirements": [
367 {
368 "maxServerVersion": "3.4.99"
369 }
370 ],
371 "operations": [
372 {
373 "name": "findOneAndReplace",
374 "object": "collection0",
375 "arguments": {
376 "filter": {
377 "_id": 1
378 },
379 "replacement": {
380 "_id": 1,
381 "a": {
382 "b.c": 1
383 }
384 }
385 },
386 "expectError": {
387 "isClientError": false
388 }
389 }
390 ],
391 "expectEvents": [
392 {
393 "client": "client0",
394 "events": [
395 {
396 "commandStartedEvent": {
397 "command": {
398 "findAndModify": "coll0",
399 "query": {
400 "_id": 1
401 },
402 "update": {
403 "_id": 1,
404 "a": {
405 "b.c": 1
406 }
407 },
408 "new": {
409 "$$unsetOrMatches": false
410 }
411 }
412 }
413 }
414 ]
415 }
416 ],
417 "outcome": [
418 {
419 "collectionName": "coll0",
420 "databaseName": "crud-tests",
421 "documents": [
422 {
423 "_id": 1
424 }
425 ]
426 }
427 ]
428 }
429 ]
430}
View as plain text