1{
2  "data": [
3    {
4      "_id": 1,
5      "x": 11
6    },
7    {
8      "_id": 2,
9      "x": 22
10    },
11    {
12      "_id": 3,
13      "x": 33
14    }
15  ],
16  "tests": [
17    {
18      "description": "FindOneAndUpdate when many documents match returning the document before modification",
19      "operation": {
20        "name": "findOneAndUpdate",
21        "arguments": {
22          "filter": {
23            "_id": {
24              "$gt": 1
25            }
26          },
27          "update": {
28            "$inc": {
29              "x": 1
30            }
31          },
32          "projection": {
33            "x": 1,
34            "_id": 0
35          },
36          "sort": {
37            "x": 1
38          }
39        }
40      },
41      "outcome": {
42        "result": {
43          "x": 22
44        },
45        "collection": {
46          "data": [
47            {
48              "_id": 1,
49              "x": 11
50            },
51            {
52              "_id": 2,
53              "x": 23
54            },
55            {
56              "_id": 3,
57              "x": 33
58            }
59          ]
60        }
61      }
62    },
63    {
64      "description": "FindOneAndUpdate when many documents match returning the document after modification",
65      "operation": {
66        "name": "findOneAndUpdate",
67        "arguments": {
68          "filter": {
69            "_id": {
70              "$gt": 1
71            }
72          },
73          "update": {
74            "$inc": {
75              "x": 1
76            }
77          },
78          "projection": {
79            "x": 1,
80            "_id": 0
81          },
82          "returnDocument": "After",
83          "sort": {
84            "x": 1
85          }
86        }
87      },
88      "outcome": {
89        "result": {
90          "x": 23
91        },
92        "collection": {
93          "data": [
94            {
95              "_id": 1,
96              "x": 11
97            },
98            {
99              "_id": 2,
100              "x": 23
101            },
102            {
103              "_id": 3,
104              "x": 33
105            }
106          ]
107        }
108      }
109    },
110    {
111      "description": "FindOneAndUpdate when one document matches returning the document before modification",
112      "operation": {
113        "name": "findOneAndUpdate",
114        "arguments": {
115          "filter": {
116            "_id": 2
117          },
118          "update": {
119            "$inc": {
120              "x": 1
121            }
122          },
123          "projection": {
124            "x": 1,
125            "_id": 0
126          },
127          "sort": {
128            "x": 1
129          }
130        }
131      },
132      "outcome": {
133        "result": {
134          "x": 22
135        },
136        "collection": {
137          "data": [
138            {
139              "_id": 1,
140              "x": 11
141            },
142            {
143              "_id": 2,
144              "x": 23
145            },
146            {
147              "_id": 3,
148              "x": 33
149            }
150          ]
151        }
152      }
153    },
154    {
155      "description": "FindOneAndUpdate when one document matches returning the document after modification",
156      "operation": {
157        "name": "findOneAndUpdate",
158        "arguments": {
159          "filter": {
160            "_id": 2
161          },
162          "update": {
163            "$inc": {
164              "x": 1
165            }
166          },
167          "projection": {
168            "x": 1,
169            "_id": 0
170          },
171          "returnDocument": "After",
172          "sort": {
173            "x": 1
174          }
175        }
176      },
177      "outcome": {
178        "result": {
179          "x": 23
180        },
181        "collection": {
182          "data": [
183            {
184              "_id": 1,
185              "x": 11
186            },
187            {
188              "_id": 2,
189              "x": 23
190            },
191            {
192              "_id": 3,
193              "x": 33
194            }
195          ]
196        }
197      }
198    },
199    {
200      "description": "FindOneAndUpdate when no documents match returning the document before modification",
201      "operation": {
202        "name": "findOneAndUpdate",
203        "arguments": {
204          "filter": {
205            "_id": 4
206          },
207          "update": {
208            "$inc": {
209              "x": 1
210            }
211          },
212          "projection": {
213            "x": 1,
214            "_id": 0
215          },
216          "sort": {
217            "x": 1
218          }
219        }
220      },
221      "outcome": {
222        "result": null,
223        "collection": {
224          "data": [
225            {
226              "_id": 1,
227              "x": 11
228            },
229            {
230              "_id": 2,
231              "x": 22
232            },
233            {
234              "_id": 3,
235              "x": 33
236            }
237          ]
238        }
239      }
240    },
241    {
242      "description": "FindOneAndUpdate when no documents match with upsert returning the document before modification",
243      "operation": {
244        "name": "findOneAndUpdate",
245        "arguments": {
246          "filter": {
247            "_id": 4
248          },
249          "update": {
250            "$inc": {
251              "x": 1
252            }
253          },
254          "projection": {
255            "x": 1,
256            "_id": 0
257          },
258          "upsert": true
259        }
260      },
261      "outcome": {
262        "result": null,
263        "collection": {
264          "data": [
265            {
266              "_id": 1,
267              "x": 11
268            },
269            {
270              "_id": 2,
271              "x": 22
272            },
273            {
274              "_id": 3,
275              "x": 33
276            },
277            {
278              "_id": 4,
279              "x": 1
280            }
281          ]
282        }
283      }
284    },
285    {
286      "description": "FindOneAndUpdate when no documents match returning the document after modification",
287      "operation": {
288        "name": "findOneAndUpdate",
289        "arguments": {
290          "filter": {
291            "_id": 4
292          },
293          "update": {
294            "$inc": {
295              "x": 1
296            }
297          },
298          "projection": {
299            "x": 1,
300            "_id": 0
301          },
302          "returnDocument": "After",
303          "sort": {
304            "x": 1
305          }
306        }
307      },
308      "outcome": {
309        "result": null,
310        "collection": {
311          "data": [
312            {
313              "_id": 1,
314              "x": 11
315            },
316            {
317              "_id": 2,
318              "x": 22
319            },
320            {
321              "_id": 3,
322              "x": 33
323            }
324          ]
325        }
326      }
327    },
328    {
329      "description": "FindOneAndUpdate when no documents match with upsert returning the document after modification",
330      "operation": {
331        "name": "findOneAndUpdate",
332        "arguments": {
333          "filter": {
334            "_id": 4
335          },
336          "update": {
337            "$inc": {
338              "x": 1
339            }
340          },
341          "projection": {
342            "x": 1,
343            "_id": 0
344          },
345          "returnDocument": "After",
346          "sort": {
347            "x": 1
348          },
349          "upsert": true
350        }
351      },
352      "outcome": {
353        "result": {
354          "x": 1
355        },
356        "collection": {
357          "data": [
358            {
359              "_id": 1,
360              "x": 11
361            },
362            {
363              "_id": 2,
364              "x": 22
365            },
366            {
367              "_id": 3,
368              "x": 33
369            },
370            {
371              "_id": 4,
372              "x": 1
373            }
374          ]
375        }
376      }
377    }
378  ]
379}
380