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