Skip to content

Commit 75edbe2

Browse files
committed
CXX-1390 Support arrayFilters
1 parent 1cb66e2 commit 75edbe2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1613
-67
lines changed

data/crud/README.rst

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,6 @@ define and setup. Therefore, these YAML tests are in no way a replacement for
1212
more thorough testing. However, they can provide an initial verification of your
1313
implementation.
1414

15-
Converting to JSON
16-
==================
17-
18-
The tests are written in YAML because it is easier for humans to write and read,
19-
and because YAML includes a standard comment format. A JSONified version of each
20-
YAML file is included in this repository. Whenever a YAML file is modified, the
21-
corresponding JSON file should be regenerated. One method to convert to JSON is
22-
using `yamljs <https://www.npmjs.com/package/yamljs>`_::
23-
24-
npm install -g yamljs
25-
yaml2json -s -p -r .
26-
2715
Version
2816
=======
2917

@@ -44,13 +32,14 @@ Each YAML file has the following keys:
4432
- ``data``: The data that should exist in the collection under test before each
4533
test run.
4634

47-
- ``minServerVersion`` (optional): The minimum server version required to
48-
successfully run the test. If this field is not present, it should be assumed
49-
that there is no lower bound on the server version required.
35+
- ``minServerVersion`` (optional): The minimum server version (inclusive)
36+
required to successfully run the test. If this field is not present, it should
37+
be assumed that there is no lower bound on the required server version.
5038

51-
- ``maxServerVersion`` (optional): The max server version against which this
52-
test can run successfully. If this field is not present, it should be assumed
53-
that there is no upper bound on the server version required.
39+
- ``maxServerVersion`` (optional): The maximum server version (exclusive)
40+
against which this test can run successfully. If this field is not present,
41+
it should be assumed that there is no upper bound on the required server
42+
version.
5443

5544
- ``tests``: An array of tests that are to be run independently of each other.
5645
Each test will have some or all of the following fields:
@@ -68,7 +57,11 @@ Each YAML file has the following keys:
6857
the collection after the operation is executed. This will have some or all
6958
of the following fields:
7059

71-
- ``result``: The return value from the operation.
60+
- ``result``: The return value from the operation. Note that some tests
61+
specify an ``upsertedCount`` field when the server does not provide
62+
one in the result document. In these cases, an ``upsertedCount`` field
63+
with a value of 0 should be manually added to the document received
64+
from the server to facilitate comparison.
7265

7366
- ``collection``:
7467

@@ -83,6 +76,5 @@ Use as integration tests
8376

8477
Running these as integration tests will require a running mongod server. Each of
8578
these tests is valid against a standalone mongod, a replica set, and a sharded
86-
system for server version 3.0.0. Many of them will run against 2.4 and 2.6, but
87-
some will require conditional code. For instance, ``$out`` is not supported in
88-
an aggregation pipeline in server 2.4, so that test must be skipped.
79+
system for server version 3.0 and later. Many of them will run against 2.6, but
80+
some will require conditional code.

data/crud/read/aggregate-collation.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@
3535
}
3636
}
3737
]
38-
}
38+
}

data/crud/read/aggregate-out.json

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,57 @@
6565
]
6666
}
6767
}
68+
},
69+
{
70+
"description": "Aggregate with $out and batch size of 0",
71+
"operation": {
72+
"name": "aggregate",
73+
"arguments": {
74+
"pipeline": [
75+
{
76+
"$sort": {
77+
"x": 1
78+
}
79+
},
80+
{
81+
"$match": {
82+
"_id": {
83+
"$gt": 1
84+
}
85+
}
86+
},
87+
{
88+
"$out": "other_test_collection"
89+
}
90+
],
91+
"batchSize": 0
92+
}
93+
},
94+
"outcome": {
95+
"result": [
96+
{
97+
"_id": 2,
98+
"x": 22
99+
},
100+
{
101+
"_id": 3,
102+
"x": 33
103+
}
104+
],
105+
"collection": {
106+
"name": "other_test_collection",
107+
"data": [
108+
{
109+
"_id": 2,
110+
"x": 22
111+
},
112+
{
113+
"_id": 3,
114+
"x": 33
115+
}
116+
]
117+
}
118+
}
68119
}
69120
]
70-
}
121+
}

data/crud/read/aggregate-out.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,24 @@ tests:
2626
data:
2727
- {_id: 2, x: 22}
2828
- {_id: 3, x: 33}
29+
-
30+
description: "Aggregate with $out and batch size of 0"
31+
operation:
32+
name: aggregate
33+
arguments:
34+
pipeline:
35+
- $sort: {x: 1}
36+
- $match:
37+
_id: {$gt: 1}
38+
- $out: "other_test_collection"
39+
batchSize: 0
40+
41+
outcome:
42+
result:
43+
- {_id: 2, x: 22}
44+
- {_id: 3, x: 33}
45+
collection:
46+
name: "other_test_collection"
47+
data:
48+
- {_id: 2, x: 22}
49+
- {_id: 3, x: 33}

data/crud/read/aggregate.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@
5050
}
5151
}
5252
]
53-
}
53+
}

data/crud/read/count-collation.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@
2626
}
2727
}
2828
]
29-
}
29+
}

data/crud/read/count.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@
5757
}
5858
}
5959
]
60-
}
60+
}

data/crud/read/distinct-collation.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@
3030
}
3131
}
3232
]
33-
}
33+
}

data/crud/read/distinct.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@
5252
}
5353
}
5454
]
55-
}
55+
}

data/crud/read/find-collation.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@
3131
}
3232
}
3333
]
34-
}
34+
}

0 commit comments

Comments
 (0)