...
1{
2 "description": "find-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": "Find with let option",
45 "runOnRequirements": [
46 {
47 "minServerVersion": "5.0"
48 }
49 ],
50 "operations": [
51 {
52 "name": "find",
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 "expectResult": [
68 {
69 "_id": 1
70 }
71 ]
72 }
73 ],
74 "expectEvents": [
75 {
76 "client": "client0",
77 "events": [
78 {
79 "commandStartedEvent": {
80 "command": {
81 "find": "coll0",
82 "filter": {
83 "$expr": {
84 "$eq": [
85 "$_id",
86 "$$id"
87 ]
88 }
89 },
90 "let": {
91 "id": 1
92 }
93 }
94 }
95 }
96 ]
97 }
98 ]
99 },
100 {
101 "description": "Find with let option unsupported (server-side error)",
102 "runOnRequirements": [
103 {
104 "minServerVersion": "3.6.0",
105 "maxServerVersion": "4.4.99"
106 }
107 ],
108 "operations": [
109 {
110 "name": "find",
111 "object": "collection0",
112 "arguments": {
113 "filter": {
114 "_id": 1
115 },
116 "let": {
117 "x": 1
118 }
119 },
120 "expectError": {
121 "errorContains": "Unrecognized field 'let'",
122 "isClientError": false
123 }
124 }
125 ],
126 "expectEvents": [
127 {
128 "client": "client0",
129 "events": [
130 {
131 "commandStartedEvent": {
132 "command": {
133 "find": "coll0",
134 "filter": {
135 "_id": 1
136 },
137 "let": {
138 "x": 1
139 }
140 }
141 }
142 }
143 ]
144 }
145 ]
146 }
147 ]
148}
View as plain text