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