Skip to content

Commit 244e7ff

Browse files
committed
PYTHON-1793 Use _id:1 in countDocuments to follow the updated CRUD spec
1 parent 66eb6da commit 244e7ff

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

pymongo/collection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1676,7 +1676,7 @@ def count_documents(self, filter, session=None, **kwargs):
16761676
pipeline.append({'$skip': kwargs.pop('skip')})
16771677
if 'limit' in kwargs:
16781678
pipeline.append({'$limit': kwargs.pop('limit')})
1679-
pipeline.append({'$group': {'_id': None, 'n': {'$sum': 1}}})
1679+
pipeline.append({'$group': {'_id': 1, 'n': {'$sum': 1}}})
16801680
cmd = SON([('aggregate', self.__name),
16811681
('pipeline', pipeline),
16821682
('cursor', {})])

test/transactions/mongos-recovery-token.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@
265265
"description": "commitTransaction retry fails on new mongos",
266266
"useMultipleMongoses": true,
267267
"clientOptions": {
268-
"heartbeatFrequencyMS": 5000
268+
"heartbeatFrequencyMS": 30000
269269
},
270270
"operations": [
271271
{

test/transactions/pin-mongos.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@
10681068
"description": "unpin after transient error within a transaction and commit",
10691069
"useMultipleMongoses": true,
10701070
"clientOptions": {
1071-
"heartbeatFrequencyMS": 5000
1071+
"heartbeatFrequencyMS": 30000
10721072
},
10731073
"operations": [
10741074
{

test/transactions/read-concern.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
},
9191
{
9292
"$group": {
93-
"_id": null,
93+
"_id": 1,
9494
"n": {
9595
"$sum": 1
9696
}
@@ -126,7 +126,7 @@
126126
},
127127
{
128128
"$group": {
129-
"_id": null,
129+
"_id": 1,
130130
"n": {
131131
"$sum": 1
132132
}
@@ -900,7 +900,7 @@
900900
},
901901
{
902902
"$group": {
903-
"_id": null,
903+
"_id": 1,
904904
"n": {
905905
"$sum": 1
906906
}
@@ -934,7 +934,7 @@
934934
},
935935
{
936936
"$group": {
937-
"_id": null,
937+
"_id": 1,
938938
"n": {
939939
"$sum": 1
940940
}

0 commit comments

Comments
 (0)