Skip to content

Commit 55500e8

Browse files
GODRIVER-2331 Replace collStats with count (#954)
* GODRIVER-2331 Add spec tests and update collStats -> counts * GODRIVER-2331 Add executeCreateView branch * GODRIVER-2331 remove empty lines from .yml file * GODRIVER-2331 fix 'separate' typo * GODRIVER-2331 pipeline is not required to make a view * GODRIVER-2331 resolve PR conversations
1 parent ef8ad53 commit 55500e8

21 files changed

+255
-1980
lines changed

data/atlas-data-lake-testing/estimatedDocumentCount.json

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,9 @@
1515
{
1616
"command_started_event": {
1717
"command": {
18-
"aggregate": "driverdata",
19-
"pipeline": [
20-
{
21-
"$collStats": {
22-
"count": {}
23-
}
24-
},
25-
{
26-
"$group": {
27-
"_id": 1,
28-
"n": {
29-
"$sum": "$count"
30-
}
31-
}
32-
}
33-
]
18+
"count": "driverdata"
3419
},
35-
"command_name": "aggregate",
20+
"command_name": "count",
3621
"database_name": "test"
3722
}
3823
}

data/atlas-data-lake-testing/estimatedDocumentCount.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ tests:
1313
-
1414
command_started_event:
1515
command:
16-
aggregate: *collection_name
17-
pipeline:
18-
- $collStats: { count: {} }
19-
- $group: { _id: 1, n: { $sum: $count }}
20-
command_name: aggregate
16+
count: *collection_name
17+
command_name: count
2118
database_name: *database_name

data/crud/unified/estimatedDocumentCount-comment.json

Lines changed: 4 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -47,65 +47,10 @@
4747
],
4848
"tests": [
4949
{
50-
"description": "estimatedDocumentCount with document comment - post 4.9",
50+
"description": "estimatedDocumentCount with document comment",
5151
"runOnRequirements": [
5252
{
53-
"minServerVersion": "4.9.0"
54-
}
55-
],
56-
"operations": [
57-
{
58-
"name": "estimatedDocumentCount",
59-
"object": "collection0",
60-
"arguments": {
61-
"comment": {
62-
"key": "value"
63-
}
64-
},
65-
"expectResult": 3
66-
}
67-
],
68-
"expectEvents": [
69-
{
70-
"client": "client0",
71-
"events": [
72-
{
73-
"commandStartedEvent": {
74-
"command": {
75-
"aggregate": "coll0",
76-
"pipeline": [
77-
{
78-
"$collStats": {
79-
"count": {}
80-
}
81-
},
82-
{
83-
"$group": {
84-
"_id": 1,
85-
"n": {
86-
"$sum": "$count"
87-
}
88-
}
89-
}
90-
],
91-
"comment": {
92-
"key": "value"
93-
}
94-
},
95-
"commandName": "aggregate",
96-
"databaseName": "edc-comment-tests"
97-
}
98-
}
99-
]
100-
}
101-
]
102-
},
103-
{
104-
"description": "estimatedDocumentCount with document comment - pre 4.9",
105-
"runOnRequirements": [
106-
{
107-
"minServerVersion": "4.4.14",
108-
"maxServerVersion": "4.8.99"
53+
"minServerVersion": "4.4.14"
10954
}
11055
],
11156
"operations": [
@@ -141,11 +86,10 @@
14186
]
14287
},
14388
{
144-
"description": "estimatedDocumentCount with string comment - pre 4.9",
89+
"description": "estimatedDocumentCount with string comment",
14590
"runOnRequirements": [
14691
{
147-
"minServerVersion": "4.4.0",
148-
"maxServerVersion": "4.8.99"
92+
"minServerVersion": "4.4.0"
14993
}
15094
],
15195
"operations": [

data/crud/unified/estimatedDocumentCount-comment.yml

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -24,39 +24,16 @@ initialData:
2424
- { _id: 3, x: 33 }
2525

2626
tests:
27-
- description: "estimatedDocumentCount with document comment - post 4.9"
28-
runOnRequirements:
29-
- minServerVersion: "4.9.0"
30-
operations:
31-
- name: estimatedDocumentCount
32-
object: *collection0
33-
arguments:
34-
comment: &documentComment { key: "value"}
35-
expectResult: 3
36-
expectEvents:
37-
- client: *client0
38-
events:
39-
- commandStartedEvent:
40-
command:
41-
aggregate: *collection0Name
42-
pipeline: &pipeline
43-
- $collStats: { count: {} }
44-
- $group: { _id: 1, n: { $sum: $count }}
45-
comment: *documentComment
46-
commandName: aggregate
47-
databaseName: *database0Name
48-
49-
- description: "estimatedDocumentCount with document comment - pre 4.9"
27+
- description: "estimatedDocumentCount with document comment"
5028
runOnRequirements:
5129
# https://jira.mongodb.org/browse/SERVER-63315
5230
# Server supports count with comment of any type for comment starting from 4.4.14.
5331
- minServerVersion: "4.4.14"
54-
maxServerVersion: "4.8.99"
5532
operations:
5633
- name: estimatedDocumentCount
5734
object: *collection0
5835
arguments:
59-
comment: *documentComment
36+
comment: &documentComment { key: "value"}
6037
expectResult: 3
6138
expectEvents:
6239
- client: *client0
@@ -68,10 +45,9 @@ tests:
6845
commandName: count
6946
databaseName: *database0Name
7047

71-
- description: "estimatedDocumentCount with string comment - pre 4.9"
48+
- description: "estimatedDocumentCount with string comment"
7249
runOnRequirements:
7350
- minServerVersion: "4.4.0"
74-
maxServerVersion: "4.8.99"
7551
operations:
7652
- name: estimatedDocumentCount
7753
object: *collection0
@@ -117,4 +93,3 @@ tests:
11793
comment: *documentComment
11894
commandName: count
11995
databaseName: *database0Name
120-

0 commit comments

Comments
 (0)