PYTHON-3167 Revert to using the count command for estimated_document_count (#934)
Resolves PYTHON-2885, PYTHON-3166, PYTHON-3224, and PYTHON-3219.
This commit is contained in:
parent
05b55e88df
commit
6e4e90a882
@ -68,17 +68,24 @@ cpjson () {
|
||||
|
||||
for spec in "$@"
|
||||
do
|
||||
# Match the spec dir name, the python test dir name, and/or common abbreviations.
|
||||
case "$spec" in
|
||||
bson*corpus)
|
||||
atlas-data-lake-testing|data_lake)
|
||||
cpjson atlas-data-lake-testing/tests/ data_lake
|
||||
;;
|
||||
bson-corpus|bson_corpus)
|
||||
cpjson bson-corpus/tests/ bson_corpus
|
||||
;;
|
||||
max*staleness)
|
||||
max-staleness|max_staleness)
|
||||
cpjson max-staleness/tests/ max_staleness
|
||||
;;
|
||||
connection*string)
|
||||
collection-management|collection_management)
|
||||
cpjson collection-management/tests/ collection_management
|
||||
;;
|
||||
connection-string|connection_string)
|
||||
cpjson connection-string/tests/ connection_string/test
|
||||
;;
|
||||
change*streams)
|
||||
change-streams|change_streams)
|
||||
cpjson change-streams/tests/ change_streams/
|
||||
;;
|
||||
client-side-encryption|csfle|fle)
|
||||
@ -87,32 +94,29 @@ do
|
||||
cpjson client-side-encryption/external/ client-side-encryption/external
|
||||
cpjson client-side-encryption/limits/ client-side-encryption/limits
|
||||
;;
|
||||
cmap|CMAP)
|
||||
cmap|CMAP|connection-monitoring-and-pooling)
|
||||
cpjson connection-monitoring-and-pooling/tests cmap
|
||||
rm $PYMONGO/test/cmap/wait-queue-fairness.json # PYTHON-1873
|
||||
;;
|
||||
command*monitoring)
|
||||
apm|APM|command-monitoring|command_monitoring)
|
||||
cpjson command-monitoring/tests command_monitoring
|
||||
;;
|
||||
crud|CRUD)
|
||||
cpjson crud/tests/ crud
|
||||
;;
|
||||
load*balancer)
|
||||
load-balancers|load_balancer)
|
||||
cpjson load-balancers/tests load_balancer
|
||||
;;
|
||||
initial-dns-seedlist-discovery|srv_seedlist)
|
||||
srv|SRV|initial-dns-seedlist-discovery|srv_seedlist)
|
||||
cpjson initial-dns-seedlist-discovery/tests/ srv_seedlist
|
||||
;;
|
||||
old_srv_seedlist)
|
||||
cpjson initial-dns-seedlist-discovery/tests srv_seedlist
|
||||
;;
|
||||
retryable*reads)
|
||||
retryable-reads|retryable_reads)
|
||||
cpjson retryable-reads/tests/ retryable_reads
|
||||
;;
|
||||
retryable*writes)
|
||||
retryable-writes|retryable_writes)
|
||||
cpjson retryable-writes/tests/ retryable_writes
|
||||
;;
|
||||
sdam|SDAM)
|
||||
sdam|SDAM|server-discovery-and-monitoring|discovery_and_monitoring)
|
||||
cpjson server-discovery-and-monitoring/tests/errors \
|
||||
discovery_and_monitoring/errors
|
||||
cpjson server-discovery-and-monitoring/tests/rs \
|
||||
@ -126,10 +130,10 @@ do
|
||||
cpjson server-discovery-and-monitoring/tests/load-balanced \
|
||||
discovery_and_monitoring/load-balanced
|
||||
;;
|
||||
sdam*monitoring)
|
||||
sdam-monitoring|sdam_monitoring)
|
||||
cpjson server-discovery-and-monitoring/tests/monitoring sdam_monitoring
|
||||
;;
|
||||
server*selection)
|
||||
server-selection|server_selection)
|
||||
cpjson server-selection/tests/ server_selection
|
||||
;;
|
||||
sessions)
|
||||
@ -140,13 +144,13 @@ do
|
||||
cpjson transactions-convenient-api/tests/ transactions-convenient-api
|
||||
rm $PYMONGO/test/transactions/legacy/errors-client.json # PYTHON-1894
|
||||
;;
|
||||
unified)
|
||||
unified|unified-test-format)
|
||||
cpjson unified-test-format/tests/ unified-test-format/
|
||||
;;
|
||||
uri|uri*options)
|
||||
uri|uri-options|uri_options)
|
||||
cpjson uri-options/tests uri_options
|
||||
;;
|
||||
stable-api)
|
||||
stable-api|versioned-api)
|
||||
cpjson versioned-api/tests versioned-api
|
||||
;;
|
||||
*)
|
||||
|
||||
@ -1,6 +1,37 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
Changes in Version 4.2
|
||||
----------------------
|
||||
|
||||
Bug fixes
|
||||
.........
|
||||
|
||||
- Fixed a bug where :meth:`~pymongo.collection.Collection.estimated_document_count`
|
||||
would fail with a "CommandNotSupportedOnView" error on views (`PYTHON-2885`_).
|
||||
|
||||
Unavoidable breaking changes
|
||||
............................
|
||||
|
||||
- :meth:`~pymongo.collection.Collection.estimated_document_count` now always uses
|
||||
the `count`_ command. Due to an oversight in versions 5.0.0-5.0.8 of MongoDB,
|
||||
the count command was not included in V1 of the :ref:`versioned-api-ref`.
|
||||
Users of the Stable API with estimated_document_count are recommended to upgrade
|
||||
their server version to 5.0.9+ or set :attr:`pymongo.server_api.ServerApi.strict`
|
||||
to ``False`` to avoid encountering errors (`PYTHON-3167`_).
|
||||
|
||||
.. _count: https://mongodb.com/docs/manual/reference/command/count/
|
||||
|
||||
Issues Resolved
|
||||
...............
|
||||
|
||||
See the `PyMongo 4.2 release notes in JIRA`_ for the list of resolved issues
|
||||
in this release.
|
||||
|
||||
.. _PYTHON-2885: https://jira.mongodb.org/browse/PYTHON-2885
|
||||
.. _PYTHON-3167: https://jira.mongodb.org/browse/PYTHON-3167
|
||||
.. _PyMongo 4.2 release notes in JIRA: https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=10004&version=33196
|
||||
|
||||
Changes in Version 4.1.1
|
||||
-------------------------
|
||||
|
||||
|
||||
@ -1707,8 +1707,15 @@ class Collection(common.BaseObject, Generic[_DocumentType]):
|
||||
command.
|
||||
- `**kwargs` (optional): See list of options above.
|
||||
|
||||
.. versionchanged:: 4.2
|
||||
This method now always uses the `count`_ command. Due to an oversight in versions
|
||||
5.0.0-5.0.8 of MongoDB, the count command was not included in V1 of the
|
||||
:ref:`versioned-api-ref`. Users of the Stable API with estimated_document_count are
|
||||
recommended to upgrade their server version to 5.0.9+ or set
|
||||
:attr:`pymongo.server_api.ServerApi.strict` to ``False`` to avoid encountering errors.
|
||||
|
||||
.. versionadded:: 3.7
|
||||
.. _count: https://mongodb.com/docs/manual/reference/command/count/
|
||||
"""
|
||||
if "session" in kwargs:
|
||||
raise ConfigurationError("estimated_document_count does not support sessions")
|
||||
@ -1716,25 +1723,9 @@ class Collection(common.BaseObject, Generic[_DocumentType]):
|
||||
kwargs["comment"] = comment
|
||||
|
||||
def _cmd(session, server, sock_info, read_preference):
|
||||
if sock_info.max_wire_version >= 12:
|
||||
# MongoDB 4.9+
|
||||
pipeline = [
|
||||
{"$collStats": {"count": {}}},
|
||||
{"$group": {"_id": 1, "n": {"$sum": "$count"}}},
|
||||
]
|
||||
cmd = SON([("aggregate", self.__name), ("pipeline", pipeline), ("cursor", {})])
|
||||
cmd.update(kwargs)
|
||||
result = self._aggregate_one_result(
|
||||
sock_info, read_preference, cmd, collation=None, session=session
|
||||
)
|
||||
if not result:
|
||||
return 0
|
||||
return int(result["n"])
|
||||
else:
|
||||
# MongoDB < 4.9
|
||||
cmd = SON([("count", self.__name)])
|
||||
cmd.update(kwargs)
|
||||
return self._count_cmd(session, sock_info, read_preference, cmd, collation=None)
|
||||
cmd = SON([("count", self.__name)])
|
||||
cmd.update(kwargs)
|
||||
return self._count_cmd(session, sock_info, read_preference, cmd, collation=None)
|
||||
|
||||
return self._retryable_non_cursor_read(_cmd, None)
|
||||
|
||||
|
||||
@ -82,14 +82,6 @@
|
||||
"databaseName": "ts-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"listCollections": 1
|
||||
},
|
||||
"databaseName": "ts-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
@ -204,14 +196,6 @@
|
||||
"databaseName": "ts-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"listCollections": 1
|
||||
},
|
||||
"databaseName": "ts-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
|
||||
155
test/crud/unified/aggregate-allowdiskuse.json
Normal file
155
test/crud/unified/aggregate-allowdiskuse.json
Normal file
@ -0,0 +1,155 @@
|
||||
{
|
||||
"description": "aggregate-allowdiskuse",
|
||||
"schemaVersion": "1.0",
|
||||
"createEntities": [
|
||||
{
|
||||
"client": {
|
||||
"id": "client0",
|
||||
"observeEvents": [
|
||||
"commandStartedEvent"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"database": {
|
||||
"id": "database0",
|
||||
"client": "client0",
|
||||
"databaseName": "crud-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": {
|
||||
"id": "collection0",
|
||||
"database": "database0",
|
||||
"collectionName": "coll0"
|
||||
}
|
||||
}
|
||||
],
|
||||
"initialData": [
|
||||
{
|
||||
"collectionName": "coll0",
|
||||
"databaseName": "crud-tests",
|
||||
"documents": []
|
||||
}
|
||||
],
|
||||
"tests": [
|
||||
{
|
||||
"description": "Aggregate does not send allowDiskUse when value is not specified",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection0",
|
||||
"name": "aggregate",
|
||||
"arguments": {
|
||||
"pipeline": [
|
||||
{
|
||||
"$match": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectEvents": [
|
||||
{
|
||||
"client": "client0",
|
||||
"events": [
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"aggregate": "coll0",
|
||||
"pipeline": [
|
||||
{
|
||||
"$match": {}
|
||||
}
|
||||
],
|
||||
"allowDiskUse": {
|
||||
"$$exists": false
|
||||
}
|
||||
},
|
||||
"commandName": "aggregate",
|
||||
"databaseName": "crud-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Aggregate sends allowDiskUse false when false is specified",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection0",
|
||||
"name": "aggregate",
|
||||
"arguments": {
|
||||
"pipeline": [
|
||||
{
|
||||
"$match": {}
|
||||
}
|
||||
],
|
||||
"allowDiskUse": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectEvents": [
|
||||
{
|
||||
"client": "client0",
|
||||
"events": [
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"aggregate": "coll0",
|
||||
"pipeline": [
|
||||
{
|
||||
"$match": {}
|
||||
}
|
||||
],
|
||||
"allowDiskUse": false
|
||||
},
|
||||
"commandName": "aggregate",
|
||||
"databaseName": "crud-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Aggregate sends allowDiskUse true when true is specified",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection0",
|
||||
"name": "aggregate",
|
||||
"arguments": {
|
||||
"pipeline": [
|
||||
{
|
||||
"$match": {}
|
||||
}
|
||||
],
|
||||
"allowDiskUse": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectEvents": [
|
||||
{
|
||||
"client": "client0",
|
||||
"events": [
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"aggregate": "coll0",
|
||||
"pipeline": [
|
||||
{
|
||||
"$match": {}
|
||||
}
|
||||
],
|
||||
"allowDiskUse": true
|
||||
},
|
||||
"commandName": "aggregate",
|
||||
"databaseName": "crud-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -150,6 +150,12 @@
|
||||
"u": {
|
||||
"_id": 1,
|
||||
"x": "replaced"
|
||||
},
|
||||
"multi": {
|
||||
"$$unsetOrMatches": false
|
||||
},
|
||||
"upsert": {
|
||||
"$$unsetOrMatches": false
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -160,6 +166,12 @@
|
||||
"$set": {
|
||||
"x": "updated"
|
||||
}
|
||||
},
|
||||
"multi": {
|
||||
"$$unsetOrMatches": false
|
||||
},
|
||||
"upsert": {
|
||||
"$$unsetOrMatches": false
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -317,6 +329,12 @@
|
||||
"u": {
|
||||
"_id": 1,
|
||||
"x": "replaced"
|
||||
},
|
||||
"multi": {
|
||||
"$$unsetOrMatches": false
|
||||
},
|
||||
"upsert": {
|
||||
"$$unsetOrMatches": false
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -327,6 +345,12 @@
|
||||
"$set": {
|
||||
"x": "updated"
|
||||
}
|
||||
},
|
||||
"multi": {
|
||||
"$$unsetOrMatches": false
|
||||
},
|
||||
"upsert": {
|
||||
"$$unsetOrMatches": false
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -388,6 +412,7 @@
|
||||
"description": "BulkWrite with comment - pre 4.4",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "3.4.0",
|
||||
"maxServerVersion": "4.2.99"
|
||||
}
|
||||
],
|
||||
|
||||
@ -95,6 +95,12 @@
|
||||
},
|
||||
"u": {
|
||||
"x": 3
|
||||
},
|
||||
"multi": {
|
||||
"$$unsetOrMatches": false
|
||||
},
|
||||
"upsert": {
|
||||
"$$unsetOrMatches": false
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -183,6 +189,12 @@
|
||||
},
|
||||
"u": {
|
||||
"x": 3
|
||||
},
|
||||
"multi": {
|
||||
"$$unsetOrMatches": false
|
||||
},
|
||||
"upsert": {
|
||||
"$$unsetOrMatches": false
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
208
test/crud/unified/countDocuments-comment.json
Normal file
208
test/crud/unified/countDocuments-comment.json
Normal file
@ -0,0 +1,208 @@
|
||||
{
|
||||
"description": "countDocuments-comment",
|
||||
"schemaVersion": "1.0",
|
||||
"createEntities": [
|
||||
{
|
||||
"client": {
|
||||
"id": "client0",
|
||||
"observeEvents": [
|
||||
"commandStartedEvent"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"database": {
|
||||
"id": "database0",
|
||||
"client": "client0",
|
||||
"databaseName": "countDocuments-comments-test"
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": {
|
||||
"id": "collection0",
|
||||
"database": "database0",
|
||||
"collectionName": "coll0"
|
||||
}
|
||||
}
|
||||
],
|
||||
"initialData": [
|
||||
{
|
||||
"collectionName": "coll0",
|
||||
"databaseName": "countDocuments-comments-test",
|
||||
"documents": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
},
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"tests": [
|
||||
{
|
||||
"description": "countDocuments with document comment",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "4.4.0"
|
||||
}
|
||||
],
|
||||
"operations": [
|
||||
{
|
||||
"name": "countDocuments",
|
||||
"object": "collection0",
|
||||
"arguments": {
|
||||
"filter": {},
|
||||
"comment": {
|
||||
"key": "value"
|
||||
}
|
||||
},
|
||||
"expectResult": 3
|
||||
}
|
||||
],
|
||||
"expectEvents": [
|
||||
{
|
||||
"client": "client0",
|
||||
"events": [
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"aggregate": "coll0",
|
||||
"pipeline": [
|
||||
{
|
||||
"$match": {}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"comment": {
|
||||
"key": "value"
|
||||
}
|
||||
},
|
||||
"commandName": "aggregate",
|
||||
"databaseName": "countDocuments-comments-test"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "countDocuments with string comment",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "3.6.0"
|
||||
}
|
||||
],
|
||||
"operations": [
|
||||
{
|
||||
"name": "countDocuments",
|
||||
"object": "collection0",
|
||||
"arguments": {
|
||||
"filter": {},
|
||||
"comment": "comment"
|
||||
},
|
||||
"expectResult": 3
|
||||
}
|
||||
],
|
||||
"expectEvents": [
|
||||
{
|
||||
"client": "client0",
|
||||
"events": [
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"aggregate": "coll0",
|
||||
"pipeline": [
|
||||
{
|
||||
"$match": {}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"comment": "comment"
|
||||
},
|
||||
"commandName": "aggregate",
|
||||
"databaseName": "countDocuments-comments-test"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "countDocuments with document comment on less than 4.4.0 - server error",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "3.6.0",
|
||||
"maxServerVersion": "4.3.99"
|
||||
}
|
||||
],
|
||||
"operations": [
|
||||
{
|
||||
"name": "countDocuments",
|
||||
"object": "collection0",
|
||||
"arguments": {
|
||||
"filter": {},
|
||||
"comment": {
|
||||
"key": "value"
|
||||
}
|
||||
},
|
||||
"expectError": {
|
||||
"isClientError": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectEvents": [
|
||||
{
|
||||
"client": "client0",
|
||||
"events": [
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"aggregate": "coll0",
|
||||
"pipeline": [
|
||||
{
|
||||
"$match": {}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"comment": {
|
||||
"key": "value"
|
||||
}
|
||||
},
|
||||
"commandName": "aggregate",
|
||||
"databaseName": "countDocuments-comments-test"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -175,6 +175,7 @@
|
||||
"description": "deleteMany with comment - pre 4.4",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "3.4.0",
|
||||
"maxServerVersion": "4.2.99"
|
||||
}
|
||||
],
|
||||
|
||||
@ -177,6 +177,7 @@
|
||||
"description": "deleteOne with comment - pre 4.4",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "3.4.0",
|
||||
"maxServerVersion": "4.2.99"
|
||||
}
|
||||
],
|
||||
|
||||
170
test/crud/unified/estimatedDocumentCount-comment.json
Normal file
170
test/crud/unified/estimatedDocumentCount-comment.json
Normal file
@ -0,0 +1,170 @@
|
||||
{
|
||||
"description": "estimatedDocumentCount-comment",
|
||||
"schemaVersion": "1.0",
|
||||
"createEntities": [
|
||||
{
|
||||
"client": {
|
||||
"id": "client0",
|
||||
"observeEvents": [
|
||||
"commandStartedEvent"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"database": {
|
||||
"id": "database0",
|
||||
"client": "client0",
|
||||
"databaseName": "edc-comment-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": {
|
||||
"id": "collection0",
|
||||
"database": "database0",
|
||||
"collectionName": "coll0"
|
||||
}
|
||||
}
|
||||
],
|
||||
"initialData": [
|
||||
{
|
||||
"collectionName": "coll0",
|
||||
"databaseName": "edc-comment-tests",
|
||||
"documents": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
},
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"tests": [
|
||||
{
|
||||
"description": "estimatedDocumentCount with document comment",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "4.4.14"
|
||||
}
|
||||
],
|
||||
"operations": [
|
||||
{
|
||||
"name": "estimatedDocumentCount",
|
||||
"object": "collection0",
|
||||
"arguments": {
|
||||
"comment": {
|
||||
"key": "value"
|
||||
}
|
||||
},
|
||||
"expectResult": 3
|
||||
}
|
||||
],
|
||||
"expectEvents": [
|
||||
{
|
||||
"client": "client0",
|
||||
"events": [
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"count": "coll0",
|
||||
"comment": {
|
||||
"key": "value"
|
||||
}
|
||||
},
|
||||
"commandName": "count",
|
||||
"databaseName": "edc-comment-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "estimatedDocumentCount with string comment",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "4.4.0"
|
||||
}
|
||||
],
|
||||
"operations": [
|
||||
{
|
||||
"name": "estimatedDocumentCount",
|
||||
"object": "collection0",
|
||||
"arguments": {
|
||||
"comment": "comment"
|
||||
},
|
||||
"expectResult": 3
|
||||
}
|
||||
],
|
||||
"expectEvents": [
|
||||
{
|
||||
"client": "client0",
|
||||
"events": [
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"count": "coll0",
|
||||
"comment": "comment"
|
||||
},
|
||||
"commandName": "count",
|
||||
"databaseName": "edc-comment-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "estimatedDocumentCount with document comment - pre 4.4.14, server error",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "3.6.0",
|
||||
"maxServerVersion": "4.4.13",
|
||||
"topologies": [
|
||||
"single",
|
||||
"replicaset"
|
||||
]
|
||||
}
|
||||
],
|
||||
"operations": [
|
||||
{
|
||||
"name": "estimatedDocumentCount",
|
||||
"object": "collection0",
|
||||
"arguments": {
|
||||
"comment": {
|
||||
"key": "value"
|
||||
}
|
||||
},
|
||||
"expectError": {
|
||||
"isClientError": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectEvents": [
|
||||
{
|
||||
"client": "client0",
|
||||
"events": [
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"count": "coll0",
|
||||
"comment": {
|
||||
"key": "value"
|
||||
}
|
||||
},
|
||||
"commandName": "count",
|
||||
"databaseName": "edc-comment-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -34,6 +34,13 @@
|
||||
"database": "database0",
|
||||
"collectionName": "coll1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": {
|
||||
"id": "collection0View",
|
||||
"database": "database0",
|
||||
"collectionName": "coll0view"
|
||||
}
|
||||
}
|
||||
],
|
||||
"initialData": [
|
||||
@ -58,288 +65,7 @@
|
||||
],
|
||||
"tests": [
|
||||
{
|
||||
"description": "estimatedDocumentCount uses $collStats on 4.9.0 or greater",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "4.9.0"
|
||||
}
|
||||
],
|
||||
"operations": [
|
||||
{
|
||||
"name": "estimatedDocumentCount",
|
||||
"object": "collection0",
|
||||
"expectResult": 3
|
||||
}
|
||||
],
|
||||
"expectEvents": [
|
||||
{
|
||||
"client": "client0",
|
||||
"events": [
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"aggregate": "coll0",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"commandName": "aggregate",
|
||||
"databaseName": "edc-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "estimatedDocumentCount with maxTimeMS on 4.9.0 or greater",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "4.9.0"
|
||||
}
|
||||
],
|
||||
"operations": [
|
||||
{
|
||||
"name": "estimatedDocumentCount",
|
||||
"object": "collection0",
|
||||
"arguments": {
|
||||
"maxTimeMS": 6000
|
||||
},
|
||||
"expectResult": 3
|
||||
}
|
||||
],
|
||||
"expectEvents": [
|
||||
{
|
||||
"client": "client0",
|
||||
"events": [
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"aggregate": "coll0",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"maxTimeMS": 6000
|
||||
},
|
||||
"commandName": "aggregate",
|
||||
"databaseName": "edc-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "estimatedDocumentCount on non-existent collection on 4.9.0 or greater",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "4.9.0"
|
||||
}
|
||||
],
|
||||
"operations": [
|
||||
{
|
||||
"name": "estimatedDocumentCount",
|
||||
"object": "collection1",
|
||||
"expectResult": 0
|
||||
}
|
||||
],
|
||||
"expectEvents": [
|
||||
{
|
||||
"client": "client0",
|
||||
"events": [
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"aggregate": "coll1",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"commandName": "aggregate",
|
||||
"databaseName": "edc-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "estimatedDocumentCount errors correctly on 4.9.0 or greater--command error",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "4.9.0"
|
||||
}
|
||||
],
|
||||
"operations": [
|
||||
{
|
||||
"name": "failPoint",
|
||||
"object": "testRunner",
|
||||
"arguments": {
|
||||
"client": "client0",
|
||||
"failPoint": {
|
||||
"configureFailPoint": "failCommand",
|
||||
"mode": {
|
||||
"times": 1
|
||||
},
|
||||
"data": {
|
||||
"failCommands": [
|
||||
"aggregate"
|
||||
],
|
||||
"errorCode": 8
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "estimatedDocumentCount",
|
||||
"object": "collection0",
|
||||
"expectError": {
|
||||
"errorCode": 8
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectEvents": [
|
||||
{
|
||||
"client": "client0",
|
||||
"events": [
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"aggregate": "coll0",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"commandName": "aggregate",
|
||||
"databaseName": "edc-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "estimatedDocumentCount errors correctly on 4.9.0 or greater--socket error",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "4.9.0"
|
||||
}
|
||||
],
|
||||
"operations": [
|
||||
{
|
||||
"name": "failPoint",
|
||||
"object": "testRunner",
|
||||
"arguments": {
|
||||
"client": "client0",
|
||||
"failPoint": {
|
||||
"configureFailPoint": "failCommand",
|
||||
"mode": {
|
||||
"times": 1
|
||||
},
|
||||
"data": {
|
||||
"failCommands": [
|
||||
"aggregate"
|
||||
],
|
||||
"closeConnection": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "estimatedDocumentCount",
|
||||
"object": "collection0",
|
||||
"expectError": {
|
||||
"isError": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectEvents": [
|
||||
{
|
||||
"client": "client0",
|
||||
"events": [
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"aggregate": "coll0",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"commandName": "aggregate",
|
||||
"databaseName": "edc-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "estimatedDocumentCount uses count on less than 4.9.0",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"maxServerVersion": "4.8.99"
|
||||
}
|
||||
],
|
||||
"description": "estimatedDocumentCount always uses count",
|
||||
"operations": [
|
||||
{
|
||||
"name": "estimatedDocumentCount",
|
||||
@ -365,12 +91,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "estimatedDocumentCount with maxTimeMS on less than 4.9.0",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"maxServerVersion": "4.8.99"
|
||||
}
|
||||
],
|
||||
"description": "estimatedDocumentCount with maxTimeMS",
|
||||
"operations": [
|
||||
{
|
||||
"name": "estimatedDocumentCount",
|
||||
@ -400,12 +121,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "estimatedDocumentCount on non-existent collection on less than 4.9.0",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"maxServerVersion": "4.8.99"
|
||||
}
|
||||
],
|
||||
"description": "estimatedDocumentCount on non-existent collection",
|
||||
"operations": [
|
||||
{
|
||||
"name": "estimatedDocumentCount",
|
||||
@ -431,11 +147,10 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "estimatedDocumentCount errors correctly on less than 4.9.0--command error",
|
||||
"description": "estimatedDocumentCount errors correctly--command error",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "4.0.0",
|
||||
"maxServerVersion": "4.8.99",
|
||||
"topologies": [
|
||||
"single",
|
||||
"replicaset"
|
||||
@ -443,7 +158,6 @@
|
||||
},
|
||||
{
|
||||
"minServerVersion": "4.2.0",
|
||||
"maxServerVersion": "4.8.99",
|
||||
"topologies": [
|
||||
"sharded"
|
||||
]
|
||||
@ -495,11 +209,10 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "estimatedDocumentCount errors correctly on less than 4.9.0--socket error",
|
||||
"description": "estimatedDocumentCount errors correctly--socket error",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "4.0.0",
|
||||
"maxServerVersion": "4.8.99",
|
||||
"topologies": [
|
||||
"single",
|
||||
"replicaset"
|
||||
@ -507,7 +220,6 @@
|
||||
},
|
||||
{
|
||||
"minServerVersion": "4.2.0",
|
||||
"maxServerVersion": "4.8.99",
|
||||
"topologies": [
|
||||
"sharded"
|
||||
]
|
||||
@ -557,6 +269,89 @@
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "estimatedDocumentCount works correctly on views",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "3.4.0"
|
||||
}
|
||||
],
|
||||
"operations": [
|
||||
{
|
||||
"name": "dropCollection",
|
||||
"object": "database0",
|
||||
"arguments": {
|
||||
"collection": "coll0view"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "createCollection",
|
||||
"object": "database0",
|
||||
"arguments": {
|
||||
"collection": "coll0view",
|
||||
"viewOn": "coll0",
|
||||
"pipeline": [
|
||||
{
|
||||
"$match": {
|
||||
"_id": {
|
||||
"$gt": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "estimatedDocumentCount",
|
||||
"object": "collection0View",
|
||||
"expectResult": 2
|
||||
}
|
||||
],
|
||||
"expectEvents": [
|
||||
{
|
||||
"client": "client0",
|
||||
"events": [
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"drop": "coll0view"
|
||||
},
|
||||
"commandName": "drop",
|
||||
"databaseName": "edc-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"create": "coll0view",
|
||||
"viewOn": "coll0",
|
||||
"pipeline": [
|
||||
{
|
||||
"$match": {
|
||||
"_id": {
|
||||
"$gt": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"commandName": "create",
|
||||
"databaseName": "edc-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"count": "coll0view"
|
||||
},
|
||||
"commandName": "count",
|
||||
"databaseName": "edc-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
],
|
||||
"tests": [
|
||||
{
|
||||
"description": "Find does not send allowDiskuse when value is not specified",
|
||||
"description": "Find does not send allowDiskUse when value is not specified",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection0",
|
||||
@ -61,7 +61,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Find sends allowDiskuse false when false is specified",
|
||||
"description": "Find sends allowDiskUse false when false is specified",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection0",
|
||||
|
||||
@ -166,6 +166,7 @@
|
||||
"description": "insertMany with comment - pre 4.4",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "3.4.0",
|
||||
"maxServerVersion": "4.2.99"
|
||||
}
|
||||
],
|
||||
|
||||
@ -162,6 +162,7 @@
|
||||
"description": "insertOne with comment - pre 4.4",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "3.4.0",
|
||||
"maxServerVersion": "4.2.99"
|
||||
}
|
||||
],
|
||||
|
||||
@ -75,6 +75,12 @@
|
||||
},
|
||||
"u": {
|
||||
"x": 22
|
||||
},
|
||||
"multi": {
|
||||
"$$unsetOrMatches": false
|
||||
},
|
||||
"upsert": {
|
||||
"$$unsetOrMatches": false
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -137,6 +143,12 @@
|
||||
},
|
||||
"u": {
|
||||
"x": 22
|
||||
},
|
||||
"multi": {
|
||||
"$$unsetOrMatches": false
|
||||
},
|
||||
"upsert": {
|
||||
"$$unsetOrMatches": false
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -166,6 +178,7 @@
|
||||
"description": "ReplaceOne with comment - pre 4.4",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "3.4.0",
|
||||
"maxServerVersion": "4.2.99"
|
||||
}
|
||||
],
|
||||
@ -202,6 +215,12 @@
|
||||
},
|
||||
"u": {
|
||||
"x": 22
|
||||
},
|
||||
"multi": {
|
||||
"$$unsetOrMatches": false
|
||||
},
|
||||
"upsert": {
|
||||
"$$unsetOrMatches": false
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
@ -94,6 +94,12 @@
|
||||
},
|
||||
"u": {
|
||||
"x": "foo"
|
||||
},
|
||||
"multi": {
|
||||
"$$unsetOrMatches": false
|
||||
},
|
||||
"upsert": {
|
||||
"$$unsetOrMatches": false
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -176,6 +182,12 @@
|
||||
},
|
||||
"u": {
|
||||
"x": "foo"
|
||||
},
|
||||
"multi": {
|
||||
"$$unsetOrMatches": false
|
||||
},
|
||||
"upsert": {
|
||||
"$$unsetOrMatches": false
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
@ -80,7 +80,10 @@
|
||||
"x": 22
|
||||
}
|
||||
},
|
||||
"multi": true
|
||||
"multi": true,
|
||||
"upsert": {
|
||||
"$$unsetOrMatches": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"comment": "comment"
|
||||
@ -147,7 +150,10 @@
|
||||
"x": 22
|
||||
}
|
||||
},
|
||||
"multi": true
|
||||
"multi": true,
|
||||
"upsert": {
|
||||
"$$unsetOrMatches": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"comment": {
|
||||
@ -176,6 +182,7 @@
|
||||
"description": "UpdateMany with comment - pre 4.4",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "3.4.0",
|
||||
"maxServerVersion": "4.2.99"
|
||||
}
|
||||
],
|
||||
@ -217,7 +224,10 @@
|
||||
"x": 22
|
||||
}
|
||||
},
|
||||
"multi": true
|
||||
"multi": true,
|
||||
"upsert": {
|
||||
"$$unsetOrMatches": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"comment": "comment"
|
||||
|
||||
@ -114,7 +114,10 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"multi": true
|
||||
"multi": true,
|
||||
"upsert": {
|
||||
"$$unsetOrMatches": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"let": {
|
||||
@ -207,7 +210,10 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"multi": true
|
||||
"multi": true,
|
||||
"upsert": {
|
||||
"$$unsetOrMatches": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"let": {
|
||||
|
||||
@ -79,6 +79,12 @@
|
||||
"$set": {
|
||||
"x": 22
|
||||
}
|
||||
},
|
||||
"multi": {
|
||||
"$$unsetOrMatches": false
|
||||
},
|
||||
"upsert": {
|
||||
"$$unsetOrMatches": false
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -145,6 +151,12 @@
|
||||
"$set": {
|
||||
"x": 22
|
||||
}
|
||||
},
|
||||
"multi": {
|
||||
"$$unsetOrMatches": false
|
||||
},
|
||||
"upsert": {
|
||||
"$$unsetOrMatches": false
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -174,6 +186,7 @@
|
||||
"description": "UpdateOne with comment - pre 4.4",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "3.4.0",
|
||||
"maxServerVersion": "4.2.99"
|
||||
}
|
||||
],
|
||||
@ -214,6 +227,12 @@
|
||||
"$set": {
|
||||
"x": 22
|
||||
}
|
||||
},
|
||||
"multi": {
|
||||
"$$unsetOrMatches": false
|
||||
},
|
||||
"upsert": {
|
||||
"$$unsetOrMatches": false
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
@ -103,7 +103,13 @@
|
||||
"x": "$$x"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"multi": {
|
||||
"$$unsetOrMatches": false
|
||||
},
|
||||
"upsert": {
|
||||
"$$unsetOrMatches": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"let": {
|
||||
@ -184,7 +190,13 @@
|
||||
"x": "$$x"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"multi": {
|
||||
"$$unsetOrMatches": false
|
||||
},
|
||||
"upsert": {
|
||||
"$$unsetOrMatches": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"let": {
|
||||
|
||||
@ -15,24 +15,9 @@
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"aggregate": "driverdata",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
"count": "driverdata"
|
||||
},
|
||||
"command_name": "aggregate",
|
||||
"command_name": "count",
|
||||
"database_name": "test"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,246 +0,0 @@
|
||||
{
|
||||
"runOn": [
|
||||
{
|
||||
"minServerVersion": "4.9.0"
|
||||
}
|
||||
],
|
||||
"database_name": "retryable-reads-tests",
|
||||
"collection_name": "coll",
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
],
|
||||
"tests": [
|
||||
{
|
||||
"description": "EstimatedDocumentCount succeeds on first attempt",
|
||||
"operations": [
|
||||
{
|
||||
"name": "estimatedDocumentCount",
|
||||
"object": "collection",
|
||||
"result": 2
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"aggregate": "coll",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"database_name": "retryable-reads-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "EstimatedDocumentCount succeeds on second attempt",
|
||||
"failPoint": {
|
||||
"configureFailPoint": "failCommand",
|
||||
"mode": {
|
||||
"times": 1
|
||||
},
|
||||
"data": {
|
||||
"failCommands": [
|
||||
"aggregate"
|
||||
],
|
||||
"closeConnection": true
|
||||
}
|
||||
},
|
||||
"operations": [
|
||||
{
|
||||
"name": "estimatedDocumentCount",
|
||||
"object": "collection",
|
||||
"result": 2
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"aggregate": "coll",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"database_name": "retryable-reads-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"aggregate": "coll",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"database_name": "retryable-reads-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "EstimatedDocumentCount fails on first attempt",
|
||||
"clientOptions": {
|
||||
"retryReads": false
|
||||
},
|
||||
"failPoint": {
|
||||
"configureFailPoint": "failCommand",
|
||||
"mode": {
|
||||
"times": 1
|
||||
},
|
||||
"data": {
|
||||
"failCommands": [
|
||||
"aggregate"
|
||||
],
|
||||
"closeConnection": true
|
||||
}
|
||||
},
|
||||
"operations": [
|
||||
{
|
||||
"name": "estimatedDocumentCount",
|
||||
"object": "collection",
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"aggregate": "coll",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"database_name": "retryable-reads-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "EstimatedDocumentCount fails on second attempt",
|
||||
"failPoint": {
|
||||
"configureFailPoint": "failCommand",
|
||||
"mode": {
|
||||
"times": 2
|
||||
},
|
||||
"data": {
|
||||
"failCommands": [
|
||||
"aggregate"
|
||||
],
|
||||
"closeConnection": true
|
||||
}
|
||||
},
|
||||
"operations": [
|
||||
{
|
||||
"name": "estimatedDocumentCount",
|
||||
"object": "collection",
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"aggregate": "coll",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"database_name": "retryable-reads-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"aggregate": "coll",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"database_name": "retryable-reads-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,911 +0,0 @@
|
||||
{
|
||||
"runOn": [
|
||||
{
|
||||
"minServerVersion": "4.9.0"
|
||||
}
|
||||
],
|
||||
"database_name": "retryable-reads-tests",
|
||||
"collection_name": "coll",
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
],
|
||||
"tests": [
|
||||
{
|
||||
"description": "EstimatedDocumentCount succeeds after InterruptedAtShutdown",
|
||||
"failPoint": {
|
||||
"configureFailPoint": "failCommand",
|
||||
"mode": {
|
||||
"times": 1
|
||||
},
|
||||
"data": {
|
||||
"failCommands": [
|
||||
"aggregate"
|
||||
],
|
||||
"errorCode": 11600
|
||||
}
|
||||
},
|
||||
"operations": [
|
||||
{
|
||||
"name": "estimatedDocumentCount",
|
||||
"object": "collection",
|
||||
"result": 2
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"aggregate": "coll",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"database_name": "retryable-reads-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"aggregate": "coll",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"database_name": "retryable-reads-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "EstimatedDocumentCount succeeds after InterruptedDueToReplStateChange",
|
||||
"failPoint": {
|
||||
"configureFailPoint": "failCommand",
|
||||
"mode": {
|
||||
"times": 1
|
||||
},
|
||||
"data": {
|
||||
"failCommands": [
|
||||
"aggregate"
|
||||
],
|
||||
"errorCode": 11602
|
||||
}
|
||||
},
|
||||
"operations": [
|
||||
{
|
||||
"name": "estimatedDocumentCount",
|
||||
"object": "collection",
|
||||
"result": 2
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"aggregate": "coll",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"database_name": "retryable-reads-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"aggregate": "coll",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"database_name": "retryable-reads-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "EstimatedDocumentCount succeeds after NotWritablePrimary",
|
||||
"failPoint": {
|
||||
"configureFailPoint": "failCommand",
|
||||
"mode": {
|
||||
"times": 1
|
||||
},
|
||||
"data": {
|
||||
"failCommands": [
|
||||
"aggregate"
|
||||
],
|
||||
"errorCode": 10107
|
||||
}
|
||||
},
|
||||
"operations": [
|
||||
{
|
||||
"name": "estimatedDocumentCount",
|
||||
"object": "collection",
|
||||
"result": 2
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"aggregate": "coll",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"database_name": "retryable-reads-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"aggregate": "coll",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"database_name": "retryable-reads-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "EstimatedDocumentCount succeeds after NotPrimaryNoSecondaryOk",
|
||||
"failPoint": {
|
||||
"configureFailPoint": "failCommand",
|
||||
"mode": {
|
||||
"times": 1
|
||||
},
|
||||
"data": {
|
||||
"failCommands": [
|
||||
"aggregate"
|
||||
],
|
||||
"errorCode": 13435
|
||||
}
|
||||
},
|
||||
"operations": [
|
||||
{
|
||||
"name": "estimatedDocumentCount",
|
||||
"object": "collection",
|
||||
"result": 2
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"aggregate": "coll",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"database_name": "retryable-reads-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"aggregate": "coll",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"database_name": "retryable-reads-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "EstimatedDocumentCount succeeds after NotPrimaryOrSecondary",
|
||||
"failPoint": {
|
||||
"configureFailPoint": "failCommand",
|
||||
"mode": {
|
||||
"times": 1
|
||||
},
|
||||
"data": {
|
||||
"failCommands": [
|
||||
"aggregate"
|
||||
],
|
||||
"errorCode": 13436
|
||||
}
|
||||
},
|
||||
"operations": [
|
||||
{
|
||||
"name": "estimatedDocumentCount",
|
||||
"object": "collection",
|
||||
"result": 2
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"aggregate": "coll",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"database_name": "retryable-reads-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"aggregate": "coll",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"database_name": "retryable-reads-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "EstimatedDocumentCount succeeds after PrimarySteppedDown",
|
||||
"failPoint": {
|
||||
"configureFailPoint": "failCommand",
|
||||
"mode": {
|
||||
"times": 1
|
||||
},
|
||||
"data": {
|
||||
"failCommands": [
|
||||
"aggregate"
|
||||
],
|
||||
"errorCode": 189
|
||||
}
|
||||
},
|
||||
"operations": [
|
||||
{
|
||||
"name": "estimatedDocumentCount",
|
||||
"object": "collection",
|
||||
"result": 2
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"aggregate": "coll",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"database_name": "retryable-reads-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"aggregate": "coll",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"database_name": "retryable-reads-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "EstimatedDocumentCount succeeds after ShutdownInProgress",
|
||||
"failPoint": {
|
||||
"configureFailPoint": "failCommand",
|
||||
"mode": {
|
||||
"times": 1
|
||||
},
|
||||
"data": {
|
||||
"failCommands": [
|
||||
"aggregate"
|
||||
],
|
||||
"errorCode": 91
|
||||
}
|
||||
},
|
||||
"operations": [
|
||||
{
|
||||
"name": "estimatedDocumentCount",
|
||||
"object": "collection",
|
||||
"result": 2
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"aggregate": "coll",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"database_name": "retryable-reads-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"aggregate": "coll",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"database_name": "retryable-reads-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "EstimatedDocumentCount succeeds after HostNotFound",
|
||||
"failPoint": {
|
||||
"configureFailPoint": "failCommand",
|
||||
"mode": {
|
||||
"times": 1
|
||||
},
|
||||
"data": {
|
||||
"failCommands": [
|
||||
"aggregate"
|
||||
],
|
||||
"errorCode": 7
|
||||
}
|
||||
},
|
||||
"operations": [
|
||||
{
|
||||
"name": "estimatedDocumentCount",
|
||||
"object": "collection",
|
||||
"result": 2
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"aggregate": "coll",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"database_name": "retryable-reads-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"aggregate": "coll",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"database_name": "retryable-reads-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "EstimatedDocumentCount succeeds after HostUnreachable",
|
||||
"failPoint": {
|
||||
"configureFailPoint": "failCommand",
|
||||
"mode": {
|
||||
"times": 1
|
||||
},
|
||||
"data": {
|
||||
"failCommands": [
|
||||
"aggregate"
|
||||
],
|
||||
"errorCode": 6
|
||||
}
|
||||
},
|
||||
"operations": [
|
||||
{
|
||||
"name": "estimatedDocumentCount",
|
||||
"object": "collection",
|
||||
"result": 2
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"aggregate": "coll",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"database_name": "retryable-reads-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"aggregate": "coll",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"database_name": "retryable-reads-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "EstimatedDocumentCount succeeds after NetworkTimeout",
|
||||
"failPoint": {
|
||||
"configureFailPoint": "failCommand",
|
||||
"mode": {
|
||||
"times": 1
|
||||
},
|
||||
"data": {
|
||||
"failCommands": [
|
||||
"aggregate"
|
||||
],
|
||||
"errorCode": 89
|
||||
}
|
||||
},
|
||||
"operations": [
|
||||
{
|
||||
"name": "estimatedDocumentCount",
|
||||
"object": "collection",
|
||||
"result": 2
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"aggregate": "coll",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"database_name": "retryable-reads-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"aggregate": "coll",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"database_name": "retryable-reads-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "EstimatedDocumentCount succeeds after SocketException",
|
||||
"failPoint": {
|
||||
"configureFailPoint": "failCommand",
|
||||
"mode": {
|
||||
"times": 1
|
||||
},
|
||||
"data": {
|
||||
"failCommands": [
|
||||
"aggregate"
|
||||
],
|
||||
"errorCode": 9001
|
||||
}
|
||||
},
|
||||
"operations": [
|
||||
{
|
||||
"name": "estimatedDocumentCount",
|
||||
"object": "collection",
|
||||
"result": 2
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"aggregate": "coll",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"database_name": "retryable-reads-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"aggregate": "coll",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"database_name": "retryable-reads-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "EstimatedDocumentCount fails after two NotWritablePrimary errors",
|
||||
"failPoint": {
|
||||
"configureFailPoint": "failCommand",
|
||||
"mode": {
|
||||
"times": 2
|
||||
},
|
||||
"data": {
|
||||
"failCommands": [
|
||||
"aggregate"
|
||||
],
|
||||
"errorCode": 10107
|
||||
}
|
||||
},
|
||||
"operations": [
|
||||
{
|
||||
"name": "estimatedDocumentCount",
|
||||
"object": "collection",
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"aggregate": "coll",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"database_name": "retryable-reads-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"aggregate": "coll",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"database_name": "retryable-reads-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "EstimatedDocumentCount fails after NotWritablePrimary when retryReads is false",
|
||||
"clientOptions": {
|
||||
"retryReads": false
|
||||
},
|
||||
"failPoint": {
|
||||
"configureFailPoint": "failCommand",
|
||||
"mode": {
|
||||
"times": 1
|
||||
},
|
||||
"data": {
|
||||
"failCommands": [
|
||||
"aggregate"
|
||||
],
|
||||
"errorCode": 10107
|
||||
}
|
||||
},
|
||||
"operations": [
|
||||
{
|
||||
"name": "estimatedDocumentCount",
|
||||
"object": "collection",
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"aggregate": "coll",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"database_name": "retryable-reads-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -2,7 +2,6 @@
|
||||
"runOn": [
|
||||
{
|
||||
"minServerVersion": "4.0",
|
||||
"maxServerVersion": "4.8.99",
|
||||
"topology": [
|
||||
"single",
|
||||
"replicaset"
|
||||
@ -10,7 +9,6 @@
|
||||
},
|
||||
{
|
||||
"minServerVersion": "4.1.7",
|
||||
"maxServerVersion": "4.8.99",
|
||||
"topology": [
|
||||
"sharded"
|
||||
]
|
||||
@ -2,7 +2,6 @@
|
||||
"runOn": [
|
||||
{
|
||||
"minServerVersion": "4.0",
|
||||
"maxServerVersion": "4.8.99",
|
||||
"topology": [
|
||||
"single",
|
||||
"replicaset"
|
||||
@ -10,7 +9,6 @@
|
||||
},
|
||||
{
|
||||
"minServerVersion": "4.1.7",
|
||||
"maxServerVersion": "4.8.99",
|
||||
"topology": [
|
||||
"sharded"
|
||||
]
|
||||
@ -226,6 +226,7 @@ class EventListenerUtil(CMAPListener, CommandListener):
|
||||
self._observe_sensitive_commands = False
|
||||
self._ignore_commands = _SENSITIVE_COMMANDS | set(ignore_commands)
|
||||
self._ignore_commands.add("configurefailpoint")
|
||||
self.ignore_list_collections = False
|
||||
self._event_mapping = collections.defaultdict(list)
|
||||
self.entity_map = entity_map
|
||||
if store_events:
|
||||
@ -256,7 +257,10 @@ class EventListenerUtil(CMAPListener, CommandListener):
|
||||
)
|
||||
|
||||
def _command_event(self, event):
|
||||
if event.command_name.lower() not in self._ignore_commands:
|
||||
if not (
|
||||
event.command_name.lower() in self._ignore_commands
|
||||
or (self.ignore_list_collections and event.command_name == "listCollections")
|
||||
):
|
||||
self.add_event(event)
|
||||
|
||||
def started(self, event):
|
||||
@ -883,6 +887,17 @@ class UnifiedSpecTestMixinV1(IntegrationTest):
|
||||
cursor = target.list_collections(*args, **kwargs)
|
||||
return list(cursor)
|
||||
|
||||
def _databaseOperation_createCollection(self, target, *args, **kwargs):
|
||||
# PYTHON-1936 Ignore the listCollections event from create_collection.
|
||||
for listener in target.client.options.event_listeners:
|
||||
if isinstance(listener, EventListenerUtil):
|
||||
listener.ignore_list_collections = True
|
||||
ret = target.create_collection(*args, **kwargs)
|
||||
for listener in target.client.options.event_listeners:
|
||||
if isinstance(listener, EventListenerUtil):
|
||||
listener.ignore_list_collections = False
|
||||
return ret
|
||||
|
||||
def __entityOperation_aggregate(self, target, *args, **kwargs):
|
||||
self.__raise_if_unsupported("aggregate", target, Database, Collection)
|
||||
return list(target.aggregate(*args, **kwargs))
|
||||
|
||||
@ -613,6 +613,15 @@
|
||||
},
|
||||
{
|
||||
"description": "estimatedDocumentCount appends declared API version",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "5.0.9",
|
||||
"maxServerVersion": "5.0.99"
|
||||
},
|
||||
{
|
||||
"minServerVersion": "5.3.2"
|
||||
}
|
||||
],
|
||||
"operations": [
|
||||
{
|
||||
"name": "estimatedDocumentCount",
|
||||
@ -627,22 +636,7 @@
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"aggregate": "test",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"count": "test",
|
||||
"apiVersion": "1",
|
||||
"apiStrict": true,
|
||||
"apiDeprecationErrors": {
|
||||
|
||||
@ -604,7 +604,16 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "estimatedDocumentCount appends declared API version on 4.9.0 or greater",
|
||||
"description": "estimatedDocumentCount appends declared API version",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "5.0.9",
|
||||
"maxServerVersion": "5.0.99"
|
||||
},
|
||||
{
|
||||
"minServerVersion": "5.3.2"
|
||||
}
|
||||
],
|
||||
"operations": [
|
||||
{
|
||||
"name": "estimatedDocumentCount",
|
||||
@ -619,22 +628,7 @@
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"aggregate": "test",
|
||||
"pipeline": [
|
||||
{
|
||||
"$collStats": {
|
||||
"count": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": 1,
|
||||
"n": {
|
||||
"$sum": "$count"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"count": "test",
|
||||
"apiVersion": "1",
|
||||
"apiStrict": {
|
||||
"$$unsetOrMatches": false
|
||||
|
||||
Loading…
Reference in New Issue
Block a user