1{
2 "description": "findOneAndDelete-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": "findOneAndDelete with let option",
45 "runOnRequirements": [
46 {
47 "minServerVersion": "5.0"
48 }
49 ],
50 "operations": [
51 {
52 "name": "findOneAndDelete",
53 "object": "collection0",
54 "arguments": {
55 "filter": {
56 "$expr": {
57 "$eq": [
58 "$_id",
59 "$$id"
60 ]
61 }
62 },
63 "let": {
64 "id": 1
65 }
66 }
67 }
68 ],
69 "expectEvents": [
70 {
71 "client": "client0",
72 "events": [
73 {
74 "commandStartedEvent": {
75 "command": {
76 "findAndModify": "coll0",
77 "query": {
78 "$expr": {
79 "$eq": [
80 "$_id",
81 "$$id"
82 ]
83 }
84 },
85 "remove": true,
86 "let": {
87 "id": 1
88 }
89 }
90 }
91 }
92 ]
93 }
94 ],
95 "outcome": [
96 {
97 "collectionName": "coll0",
98 "databaseName": "crud-tests",
99 "documents": [
100 {
101 "_id": 2
102 }
103 ]
104 }
105 ]
106 },
107 {
108 "description": "findOneAndDelete with let option unsupported (server-side error)",
109 "runOnRequirements": [
110 {
111 "minServerVersion": "4.2.0",
112 "maxServerVersion": "4.4.99"
113 }
114 ],
115 "operations": [
116 {
117 "name": "findOneAndDelete",
118 "object": "collection0",
119 "arguments": {
120 "filter": {
121 "$expr": {
122 "$eq": [
123 "$_id",
124 "$$id"
125 ]
126 }
127 },
128 "let": {
129 "id": 1
130 }
131 },
132 "expectError": {
133 "errorContains": "field 'let' is an unknown field",
134 "isClientError": false
135 }
136 }
137 ],
138 "expectEvents": [
139 {
140 "client": "client0",
141 "events": [
142 {
143 "commandStartedEvent": {
144 "command": {
145 "findAndModify": "coll0",
146 "query": {
147 "$expr": {
148 "$eq": [
149 "$_id",
150 "$$id"
151 ]
152 }
153 },
154 "remove": true,
155 "let": {
156 "id": 1
157 }
158 }
159 }
160 }
161 ]
162 }
163 ],
164 "outcome": [
165 {
166 "collectionName": "coll0",
167 "databaseName": "crud-tests",
168 "documents": [
169 {
170 "_id": 1
171 },
172 {
173 "_id": 2
174 }
175 ]
176 }
177 ]
178 }
179 ]
180}
View as plain text