1{
2 "description": "updateOne-let",
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 "_id": 2
38 }
39 ]
40 }
41 ],
42 "tests": [
43 {
44 "description": "UpdateOne with let option",
45 "runOnRequirements": [
46 {
47 "minServerVersion": "5.0"
48 }
49 ],
50 "operations": [
51 {
52 "name": "updateOne",
53 "object": "collection0",
54 "arguments": {
55 "filter": {
56 "$expr": {
57 "$eq": [
58 "$_id",
59 "$$id"
60 ]
61 }
62 },
63 "update": [
64 {
65 "$set": {
66 "x": "$$x"
67 }
68 }
69 ],
70 "let": {
71 "id": 1,
72 "x": "foo"
73 }
74 },
75 "expectResult": {
76 "matchedCount": 1,
77 "modifiedCount": 1,
78 "upsertedCount": 0
79 }
80 }
81 ],
82 "expectEvents": [
83 {
84 "client": "client0",
85 "events": [
86 {
87 "commandStartedEvent": {
88 "command": {
89 "update": "coll0",
90 "updates": [
91 {
92 "q": {
93 "$expr": {
94 "$eq": [
95 "$_id",
96 "$$id"
97 ]
98 }
99 },
100 "u": [
101 {
102 "$set": {
103 "x": "$$x"
104 }
105 }
106 ],
107 "multi": {
108 "$$unsetOrMatches": false
109 },
110 "upsert": {
111 "$$unsetOrMatches": false
112 }
113 }
114 ],
115 "let": {
116 "id": 1,
117 "x": "foo"
118 }
119 }
120 }
121 }
122 ]
123 }
124 ],
125 "outcome": [
126 {
127 "collectionName": "coll0",
128 "databaseName": "crud-tests",
129 "documents": [
130 {
131 "_id": 1,
132 "x": "foo"
133 },
134 {
135 "_id": 2
136 }
137 ]
138 }
139 ]
140 },
141 {
142 "description": "UpdateOne with let option unsupported (server-side error)",
143 "runOnRequirements": [
144 {
145 "minServerVersion": "4.2.0",
146 "maxServerVersion": "4.4.99"
147 }
148 ],
149 "operations": [
150 {
151 "name": "updateOne",
152 "object": "collection0",
153 "arguments": {
154 "filter": {
155 "_id": 1
156 },
157 "update": [
158 {
159 "$set": {
160 "x": "$$x"
161 }
162 }
163 ],
164 "let": {
165 "x": "foo"
166 }
167 },
168 "expectError": {
169 "errorContains": "'update.let' is an unknown field",
170 "isClientError": false
171 }
172 }
173 ],
174 "expectEvents": [
175 {
176 "client": "client0",
177 "events": [
178 {
179 "commandStartedEvent": {
180 "command": {
181 "update": "coll0",
182 "updates": [
183 {
184 "q": {
185 "_id": 1
186 },
187 "u": [
188 {
189 "$set": {
190 "x": "$$x"
191 }
192 }
193 ],
194 "multi": {
195 "$$unsetOrMatches": false
196 },
197 "upsert": {
198 "$$unsetOrMatches": false
199 }
200 }
201 ],
202 "let": {
203 "x": "foo"
204 }
205 }
206 }
207 }
208 ]
209 }
210 ],
211 "outcome": [
212 {
213 "collectionName": "coll0",
214 "databaseName": "crud-tests",
215 "documents": [
216 {
217 "_id": 1
218 },
219 {
220 "_id": 2
221 }
222 ]
223 }
224 ]
225 }
226 ]
227}
View as plain text