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": "FindOneAndReplace when many documents match returning the document before modification",
19 "operation": {
20 "name": "findOneAndReplace",
21 "arguments": {
22 "filter": {
23 "_id": {
24 "$gt": 1
25 }
26 },
27 "replacement": {
28 "x": 32
29 },
30 "projection": {
31 "x": 1,
32 "_id": 0
33 },
34 "sort": {
35 "x": 1
36 }
37 }
38 },
39 "outcome": {
40 "result": {
41 "x": 22
42 },
43 "collection": {
44 "data": [
45 {
46 "_id": 1,
47 "x": 11
48 },
49 {
50 "_id": 2,
51 "x": 32
52 },
53 {
54 "_id": 3,
55 "x": 33
56 }
57 ]
58 }
59 }
60 },
61 {
62 "description": "FindOneAndReplace when many documents match returning the document after modification",
63 "operation": {
64 "name": "findOneAndReplace",
65 "arguments": {
66 "filter": {
67 "_id": {
68 "$gt": 1
69 }
70 },
71 "replacement": {
72 "x": 32
73 },
74 "projection": {
75 "x": 1,
76 "_id": 0
77 },
78 "returnDocument": "After",
79 "sort": {
80 "x": 1
81 }
82 }
83 },
84 "outcome": {
85 "result": {
86 "x": 32
87 },
88 "collection": {
89 "data": [
90 {
91 "_id": 1,
92 "x": 11
93 },
94 {
95 "_id": 2,
96 "x": 32
97 },
98 {
99 "_id": 3,
100 "x": 33
101 }
102 ]
103 }
104 }
105 },
106 {
107 "description": "FindOneAndReplace when one document matches returning the document before modification",
108 "operation": {
109 "name": "findOneAndReplace",
110 "arguments": {
111 "filter": {
112 "_id": 2
113 },
114 "replacement": {
115 "x": 32
116 },
117 "projection": {
118 "x": 1,
119 "_id": 0
120 },
121 "sort": {
122 "x": 1
123 }
124 }
125 },
126 "outcome": {
127 "result": {
128 "x": 22
129 },
130 "collection": {
131 "data": [
132 {
133 "_id": 1,
134 "x": 11
135 },
136 {
137 "_id": 2,
138 "x": 32
139 },
140 {
141 "_id": 3,
142 "x": 33
143 }
144 ]
145 }
146 }
147 },
148 {
149 "description": "FindOneAndReplace when one document matches returning the document after modification",
150 "operation": {
151 "name": "findOneAndReplace",
152 "arguments": {
153 "filter": {
154 "_id": 2
155 },
156 "replacement": {
157 "x": 32
158 },
159 "projection": {
160 "x": 1,
161 "_id": 0
162 },
163 "returnDocument": "After",
164 "sort": {
165 "x": 1
166 }
167 }
168 },
169 "outcome": {
170 "result": {
171 "x": 32
172 },
173 "collection": {
174 "data": [
175 {
176 "_id": 1,
177 "x": 11
178 },
179 {
180 "_id": 2,
181 "x": 32
182 },
183 {
184 "_id": 3,
185 "x": 33
186 }
187 ]
188 }
189 }
190 },
191 {
192 "description": "FindOneAndReplace when no documents match returning the document before modification",
193 "operation": {
194 "name": "findOneAndReplace",
195 "arguments": {
196 "filter": {
197 "_id": 4
198 },
199 "replacement": {
200 "x": 44
201 },
202 "projection": {
203 "x": 1,
204 "_id": 0
205 },
206 "sort": {
207 "x": 1
208 }
209 }
210 },
211 "outcome": {
212 "result": null,
213 "collection": {
214 "data": [
215 {
216 "_id": 1,
217 "x": 11
218 },
219 {
220 "_id": 2,
221 "x": 22
222 },
223 {
224 "_id": 3,
225 "x": 33
226 }
227 ]
228 }
229 }
230 },
231 {
232 "description": "FindOneAndReplace when no documents match returning the document after modification",
233 "operation": {
234 "name": "findOneAndReplace",
235 "arguments": {
236 "filter": {
237 "_id": 4
238 },
239 "replacement": {
240 "x": 44
241 },
242 "projection": {
243 "x": 1,
244 "_id": 0
245 },
246 "returnDocument": "After",
247 "sort": {
248 "x": 1
249 }
250 }
251 },
252 "outcome": {
253 "result": null,
254 "collection": {
255 "data": [
256 {
257 "_id": 1,
258 "x": 11
259 },
260 {
261 "_id": 2,
262 "x": 22
263 },
264 {
265 "_id": 3,
266 "x": 33
267 }
268 ]
269 }
270 }
271 }
272 ]
273}
View as plain text