Skip to content

Commit b30e4ff

Browse files
committed
CSHARP-2656: Database-level aggregation should be tested on server versions 3.6+
1 parent 16cdf44 commit b30e4ff

File tree

2 files changed

+30
-122
lines changed

2 files changed

+30
-122
lines changed

tests/MongoDB.Driver.Tests/Specifications/crud/tests/read/db-aggregate.json

Lines changed: 17 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,148 +1,73 @@
11
{
22
"database_name": "admin",
3-
"minServerVersion": "4.0",
3+
"minServerVersion": "3.6",
44
"tests": [
55
{
6-
"description": "Aggregate with $currentOp",
6+
"description": "Aggregate with $listLocalSessions",
77
"operations": [
88
{
99
"name": "aggregate",
1010
"object": "database",
1111
"arguments": {
1212
"pipeline": [
1313
{
14-
"$currentOp": {
15-
"allUsers": false,
16-
"idleConnections": false,
17-
"localOps": true
18-
}
14+
"$listLocalSessions": {}
1915
},
2016
{
21-
"$match": {
22-
"command.aggregate": {
23-
"$eq": 1
24-
}
25-
}
17+
"$limit": 1
2618
},
2719
{
28-
"$project": {
29-
"command": 1
20+
"$addFields": {
21+
"dummy": "dummy field"
3022
}
3123
},
3224
{
3325
"$project": {
34-
"command.lsid": 0
26+
"_id": 0,
27+
"dummy": 1
3528
}
3629
}
3730
]
3831
},
3932
"result": [
4033
{
41-
"command": {
42-
"aggregate": 1,
43-
"pipeline": [
44-
{
45-
"$currentOp": {
46-
"allUsers": false,
47-
"idleConnections": false,
48-
"localOps": true
49-
}
50-
},
51-
{
52-
"$match": {
53-
"command.aggregate": {
54-
"$eq": 1
55-
}
56-
}
57-
},
58-
{
59-
"$project": {
60-
"command": 1
61-
}
62-
},
63-
{
64-
"$project": {
65-
"command.lsid": 0
66-
}
67-
}
68-
],
69-
"cursor": {},
70-
"$db": "admin"
71-
}
34+
"dummy": "dummy field"
7235
}
7336
]
7437
}
7538
]
7639
},
7740
{
78-
"description": "Aggregate with $currentOp and allowDiskUse",
41+
"description": "Aggregate with $listLocalSessions and allowDiskUse",
7942
"operations": [
8043
{
8144
"name": "aggregate",
8245
"object": "database",
8346
"arguments": {
8447
"pipeline": [
8548
{
86-
"$currentOp": {
87-
"allUsers": true,
88-
"idleConnections": true,
89-
"localOps": true
90-
}
49+
"$listLocalSessions": {}
9150
},
9251
{
93-
"$match": {
94-
"command.aggregate": {
95-
"$eq": 1
96-
}
97-
}
52+
"$limit": 1
9853
},
9954
{
100-
"$project": {
101-
"command": 1
55+
"$addFields": {
56+
"dummy": "dummy field"
10257
}
10358
},
10459
{
10560
"$project": {
106-
"command.lsid": 0
61+
"_id": 0,
62+
"dummy": 1
10763
}
10864
}
10965
],
11066
"allowDiskUse": true
11167
},
11268
"result": [
11369
{
114-
"command": {
115-
"aggregate": 1,
116-
"pipeline": [
117-
{
118-
"$currentOp": {
119-
"allUsers": true,
120-
"idleConnections": true,
121-
"localOps": true
122-
}
123-
},
124-
{
125-
"$match": {
126-
"command.aggregate": {
127-
"$eq": 1
128-
}
129-
}
130-
},
131-
{
132-
"$project": {
133-
"command": 1
134-
}
135-
},
136-
{
137-
"$project": {
138-
"command.lsid": 0
139-
}
140-
}
141-
],
142-
"allowDiskUse": true,
143-
"cursor": {},
144-
"$db": "admin"
145-
}
70+
"dummy": "dummy field"
14671
}
14772
]
14873
}
Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,36 @@
11
database_name: &database_name "admin"
22

3-
minServerVersion: '4.0'
3+
minServerVersion: '3.6'
44

55
tests:
66
-
7-
description: "Aggregate with $currentOp"
7+
description: "Aggregate with $listLocalSessions"
88
operations:
99
-
1010
name: aggregate
1111
object: database
1212
arguments:
1313
pipeline:
14-
- $currentOp: { allUsers: false, idleConnections: false, localOps: true }
15-
- $match: { command.aggregate: { $eq: 1 } }
16-
- $project: { command: 1 }
17-
- $project: { command.lsid: 0 }
14+
- $listLocalSessions: { }
15+
- $limit: 1
16+
- $addFields: { dummy: "dummy field"}
17+
- $project: { _id: 0, dummy: 1}
1818
result:
1919
-
20-
command:
21-
aggregate: 1
22-
pipeline:
23-
- $currentOp: { allUsers: false, idleConnections: false, localOps: true }
24-
- $match: { command.aggregate: { $eq: 1 } }
25-
- $project: { command: 1 }
26-
- $project: { command.lsid: 0 }
27-
cursor: {}
28-
$db: "admin"
20+
dummy: "dummy field"
2921
-
30-
description: "Aggregate with $currentOp and allowDiskUse"
22+
description: "Aggregate with $listLocalSessions and allowDiskUse"
3123
operations:
3224
-
3325
name: aggregate
3426
object: database
3527
arguments:
3628
pipeline:
37-
- $currentOp: { allUsers: true, idleConnections: true, localOps: true }
38-
- $match: { command.aggregate: {$eq: 1} }
39-
- $project: { command: 1 }
40-
- $project: { command.lsid: 0 }
29+
- $listLocalSessions: { }
30+
- $limit: 1
31+
- $addFields: { dummy: "dummy field"}
32+
- $project: { _id: 0, dummy: 1 }
4133
allowDiskUse: true
4234
result:
4335
-
44-
command:
45-
aggregate: 1
46-
pipeline:
47-
- $currentOp: { allUsers: true, idleConnections: true, localOps: true }
48-
- $match: { command.aggregate: { $eq: 1 } }
49-
- $project: { command: 1 }
50-
- $project: { command.lsid: 0 }
51-
allowDiskUse: true
52-
cursor: {}
53-
$db: "admin"
36+
dummy: "dummy field"

0 commit comments

Comments
 (0)