Skip to content

Commit 2fc3a98

Browse files
committed
Sync CRUD spec tests for POC
Synced with mongodb/specifications#1533
1 parent 74ec5c1 commit 2fc3a98

35 files changed

+6193
-0
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"description": "aggregate-collation",
3+
"schemaVersion": "1.4",
4+
"runOnRequirements": [
5+
{
6+
"minServerVersion": "3.4",
7+
"serverless": "forbid"
8+
}
9+
],
10+
"createEntities": [
11+
{
12+
"client": {
13+
"id": "client0"
14+
}
15+
},
16+
{
17+
"database": {
18+
"id": "database0",
19+
"client": "client0",
20+
"databaseName": "crud-v1"
21+
}
22+
},
23+
{
24+
"collection": {
25+
"id": "collection0",
26+
"database": "database0",
27+
"collectionName": "coll"
28+
}
29+
}
30+
],
31+
"initialData": [
32+
{
33+
"collectionName": "coll",
34+
"databaseName": "crud-v1",
35+
"documents": [
36+
{
37+
"_id": 1,
38+
"x": "ping"
39+
}
40+
]
41+
}
42+
],
43+
"tests": [
44+
{
45+
"description": "Aggregate with collation",
46+
"operations": [
47+
{
48+
"object": "collection0",
49+
"name": "aggregate",
50+
"arguments": {
51+
"pipeline": [
52+
{
53+
"$match": {
54+
"x": "PING"
55+
}
56+
}
57+
],
58+
"collation": {
59+
"locale": "en_US",
60+
"strength": 2
61+
}
62+
},
63+
"expectResult": [
64+
{
65+
"_id": 1,
66+
"x": "ping"
67+
}
68+
]
69+
}
70+
]
71+
}
72+
]
73+
}
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
{
2+
"description": "aggregate-out",
3+
"schemaVersion": "1.4",
4+
"runOnRequirements": [
5+
{
6+
"minServerVersion": "2.6",
7+
"serverless": "forbid"
8+
}
9+
],
10+
"createEntities": [
11+
{
12+
"client": {
13+
"id": "client0"
14+
}
15+
},
16+
{
17+
"database": {
18+
"id": "database0",
19+
"client": "client0",
20+
"databaseName": "crud-v1"
21+
}
22+
},
23+
{
24+
"collection": {
25+
"id": "collection0",
26+
"database": "database0",
27+
"collectionName": "coll"
28+
}
29+
}
30+
],
31+
"initialData": [
32+
{
33+
"collectionName": "coll",
34+
"databaseName": "crud-v1",
35+
"documents": [
36+
{
37+
"_id": 1,
38+
"x": 11
39+
},
40+
{
41+
"_id": 2,
42+
"x": 22
43+
},
44+
{
45+
"_id": 3,
46+
"x": 33
47+
}
48+
]
49+
}
50+
],
51+
"tests": [
52+
{
53+
"description": "Aggregate with $out",
54+
"operations": [
55+
{
56+
"object": "collection0",
57+
"name": "aggregate",
58+
"arguments": {
59+
"pipeline": [
60+
{
61+
"$sort": {
62+
"x": 1
63+
}
64+
},
65+
{
66+
"$match": {
67+
"_id": {
68+
"$gt": 1
69+
}
70+
}
71+
},
72+
{
73+
"$out": "other_test_collection"
74+
}
75+
],
76+
"batchSize": 2
77+
}
78+
}
79+
],
80+
"outcome": [
81+
{
82+
"collectionName": "other_test_collection",
83+
"databaseName": "crud-v1",
84+
"documents": [
85+
{
86+
"_id": 2,
87+
"x": 22
88+
},
89+
{
90+
"_id": 3,
91+
"x": 33
92+
}
93+
]
94+
}
95+
]
96+
},
97+
{
98+
"description": "Aggregate with $out and batch size of 0",
99+
"operations": [
100+
{
101+
"object": "collection0",
102+
"name": "aggregate",
103+
"arguments": {
104+
"pipeline": [
105+
{
106+
"$sort": {
107+
"x": 1
108+
}
109+
},
110+
{
111+
"$match": {
112+
"_id": {
113+
"$gt": 1
114+
}
115+
}
116+
},
117+
{
118+
"$out": "other_test_collection"
119+
}
120+
],
121+
"batchSize": 0
122+
}
123+
}
124+
],
125+
"outcome": [
126+
{
127+
"collectionName": "other_test_collection",
128+
"databaseName": "crud-v1",
129+
"documents": [
130+
{
131+
"_id": 2,
132+
"x": 22
133+
},
134+
{
135+
"_id": 3,
136+
"x": 33
137+
}
138+
]
139+
}
140+
]
141+
}
142+
]
143+
}

tests/UnifiedSpecTests/crud/aggregate.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,54 @@
562562
]
563563
}
564564
]
565+
},
566+
{
567+
"description": "Aggregate with multiple stages",
568+
"operations": [
569+
{
570+
"object": "collection0",
571+
"name": "aggregate",
572+
"arguments": {
573+
"pipeline": [
574+
{
575+
"$sort": {
576+
"x": 1
577+
}
578+
},
579+
{
580+
"$match": {
581+
"_id": {
582+
"$gt": 1
583+
}
584+
}
585+
}
586+
],
587+
"batchSize": 2
588+
},
589+
"expectResult": [
590+
{
591+
"_id": 2,
592+
"x": 22
593+
},
594+
{
595+
"_id": 3,
596+
"x": 33
597+
},
598+
{
599+
"_id": 4,
600+
"x": 44
601+
},
602+
{
603+
"_id": 5,
604+
"x": 55
605+
},
606+
{
607+
"_id": 6,
608+
"x": 66
609+
}
610+
]
611+
}
612+
]
565613
}
566614
]
567615
}

tests/UnifiedSpecTests/crud/bulkWrite-arrayFilters.json

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,91 @@
274274
]
275275
}
276276
]
277+
},
278+
{
279+
"description": "BulkWrite with arrayFilters",
280+
"operations": [
281+
{
282+
"object": "collection0",
283+
"name": "bulkWrite",
284+
"arguments": {
285+
"requests": [
286+
{
287+
"updateOne": {
288+
"filter": {},
289+
"update": {
290+
"$set": {
291+
"y.$[i].b": 2
292+
}
293+
},
294+
"arrayFilters": [
295+
{
296+
"i.b": 3
297+
}
298+
]
299+
}
300+
},
301+
{
302+
"updateMany": {
303+
"filter": {},
304+
"update": {
305+
"$set": {
306+
"y.$[i].b": 2
307+
}
308+
},
309+
"arrayFilters": [
310+
{
311+
"i.b": 1
312+
}
313+
]
314+
}
315+
}
316+
],
317+
"ordered": true
318+
},
319+
"expectResult": {
320+
"deletedCount": 0,
321+
"insertedCount": 0,
322+
"insertedIds": {
323+
"$$unsetOrMatches": {}
324+
},
325+
"matchedCount": 3,
326+
"modifiedCount": 3,
327+
"upsertedCount": 0,
328+
"upsertedIds": {}
329+
}
330+
}
331+
],
332+
"outcome": [
333+
{
334+
"collectionName": "test",
335+
"databaseName": "crud-tests",
336+
"documents": [
337+
{
338+
"_id": 1,
339+
"y": [
340+
{
341+
"b": 2
342+
},
343+
{
344+
"b": 2
345+
}
346+
]
347+
},
348+
{
349+
"_id": 2,
350+
"y": [
351+
{
352+
"b": 0
353+
},
354+
{
355+
"b": 2
356+
}
357+
]
358+
}
359+
]
360+
}
361+
]
277362
}
278363
]
279364
}

0 commit comments

Comments
 (0)