From c43037606247a689cb5ada0099b8628a2c495bdd Mon Sep 17 00:00:00 2001 From: Patrick Freed Date: Tue, 26 Apr 2022 17:30:38 -0400 Subject: [PATCH] DRIVERS-2228 Revert to using the `count` command for `estimatedDocumentCount` (#1187) --- .../tests/estimatedDocumentCount.json | 19 +- .../tests/estimatedDocumentCount.yml | 7 +- source/crud/crud.rst | 69 +- .../estimatedDocumentCount-comment.json | 64 +- .../estimatedDocumentCount-comment.yml | 30 +- .../tests/unified/estimatedDocumentCount.json | 305 +----- .../tests/unified/estimatedDocumentCount.yml | 140 +-- .../legacy/estimatedDocumentCount-4.9.json | 246 ----- .../legacy/estimatedDocumentCount-4.9.yml | 60 -- ...timatedDocumentCount-serverErrors-4.9.json | 911 ------------------ ...stimatedDocumentCount-serverErrors-4.9.yml | 146 --- ... estimatedDocumentCount-serverErrors.json} | 2 - ...> estimatedDocumentCount-serverErrors.yml} | 2 - ...re4.9.json => estimatedDocumentCount.json} | 2 - ...-pre4.9.yml => estimatedDocumentCount.yml} | 2 - .../tests/crud-api-version-1-strict.json | 26 +- .../tests/crud-api-version-1-strict.yml | 10 +- .../tests/crud-api-version-1.json | 28 +- .../tests/crud-api-version-1.yml | 12 +- source/wireversion-featurelist.rst | 3 +- 20 files changed, 97 insertions(+), 1987 deletions(-) delete mode 100644 source/retryable-reads/tests/legacy/estimatedDocumentCount-4.9.json delete mode 100644 source/retryable-reads/tests/legacy/estimatedDocumentCount-4.9.yml delete mode 100644 source/retryable-reads/tests/legacy/estimatedDocumentCount-serverErrors-4.9.json delete mode 100644 source/retryable-reads/tests/legacy/estimatedDocumentCount-serverErrors-4.9.yml rename source/retryable-reads/tests/legacy/{estimatedDocumentCount-serverErrors-pre4.9.json => estimatedDocumentCount-serverErrors.json} (99%) rename source/retryable-reads/tests/legacy/{estimatedDocumentCount-serverErrors-pre4.9.yml => estimatedDocumentCount-serverErrors.yml} (98%) rename source/retryable-reads/tests/legacy/{estimatedDocumentCount-pre4.9.json => estimatedDocumentCount.json} (97%) rename source/retryable-reads/tests/legacy/{estimatedDocumentCount-pre4.9.yml => estimatedDocumentCount.yml} (96%) diff --git a/source/atlas-data-lake-testing/tests/estimatedDocumentCount.json b/source/atlas-data-lake-testing/tests/estimatedDocumentCount.json index 87b385208d..997a3ab3fc 100644 --- a/source/atlas-data-lake-testing/tests/estimatedDocumentCount.json +++ b/source/atlas-data-lake-testing/tests/estimatedDocumentCount.json @@ -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" } } diff --git a/source/atlas-data-lake-testing/tests/estimatedDocumentCount.yml b/source/atlas-data-lake-testing/tests/estimatedDocumentCount.yml index 144831173f..64c6bbd04f 100644 --- a/source/atlas-data-lake-testing/tests/estimatedDocumentCount.yml +++ b/source/atlas-data-lake-testing/tests/estimatedDocumentCount.yml @@ -13,9 +13,6 @@ tests: - command_started_event: command: - aggregate: *collection_name - pipeline: - - $collStats: { count: {} } - - $group: { _id: 1, n: { $sum: $count }} - command_name: aggregate + count: *collection_name + command_name: count database_name: *database_name diff --git a/source/crud/crud.rst b/source/crud/crud.rst index 471e31a6e9..1104923577 100644 --- a/source/crud/crud.rst +++ b/source/crud/crud.rst @@ -179,7 +179,8 @@ Read /** * Gets an estimate of the count of documents in a collection using collection metadata. * - * See "Count API Details" section below. + * See "Count API Details" section below for implementation and documentation + * requirements. */ estimatedDocumentCount(options: Optional): Int64; @@ -412,9 +413,8 @@ Read * The comment can be any valid BSON type for server versions 4.4.14 and above. * For server versions between 4.4.0 and 4.4.14 string comment is supported. * Servers versions below 4.4.0 do not support comment for count command, - * which is used to implement estimatedDocumentCount for server versions - * versions less than 4.9.0. Therefore, providing a comment may result - * in a server-side error. + * which is used to implement estimatedDocumentCount. Therefore, providing a + * comment may result in a server-side error. */ comment: Optional; } @@ -754,30 +754,39 @@ older sharded clusters. estimatedDocumentCount ~~~~~~~~~~~~~~~~~~~~~~ -On server versions greater than or equal to 4.9.0 (wire version 12 or higher), -the estimatedDocumentCount function is implemented using the ``$collStats`` -aggregate pipeline stage with ``$group`` to gather results from multiple shards. -As documented above, the only supported option is maxTimeMS:: - - pipeline = [ - { '$collStats': { 'count': {} } }, - { '$group': { '_id': 1, 'n': { '$sum': '$count' } } } - ] - -Similar to the count command, the estimated count of documents is returned -in the ``n`` field. Implementations can assume that the document containing -the single result of the aggregation pipeline is contained in the first batch of -the server's reply to the aggregate command. It is not necessary to execute a getMore -operation to ensure that the result is available. - -In the event this aggregation is run against a non-existent namespace, a NamespaceNotFound(26) -error will be returned during execution. Drivers MUST interpret the server error code 26 as -a ``0`` count. - -For server versions less than 4.9.0 (wire version 11 or under), the estimatedDocumentCount -function is implemented using the ``count`` command with no query filter, skip, -limit, or other options that would alter the results. Once again, the only supported -option is maxTimeMS. +The estimatedDocumentCount function is implemented using the ``count`` command +with no query filter, skip, limit, or other options that would alter the +results. The only supported options are listed in the +``EstimatedDocumentCountOptions`` type defined above. + +Drivers MUST document that, due to an oversight in versions 5.0.0-5.0.7 of +MongoDB, the ``count`` command, which estimatedDocumentCount uses in its +implementation, was not included in v1 of the Stable API, and so users of the +Stable API with estimatedDocumentCount are recommended to upgrade their server +version to 5.0.8+ or set ``apiStrict: false`` to avoid encountering errors. + +Drivers MUST document that the ``count`` server command is used to implement +estimatedDocumentCount and that users can find more information via +`Count: Behavior `_. + +The 5.0-compat versions of many drivers updated their estimatedDocumentCount +implementations to use the ``$collStats`` aggregation stage instead of the +``count`` command. This had the unintended consequence of breaking +estimatedDocumentCount on views, and so the change was seen as a +backwards-incompatible regression and reverted. The release notes for the driver +versions that include the reversion from ``$collStats`` back to ``count`` MUST +document the following: + +- The 5.0-compat release accidentally broke estimatedDocumentCount on views by + changing its implementation to use ``aggregate`` and a ``$collStats`` stage + instead of the ``count`` command. +- The new release is fixing estimatedDocumentCount on views by reverting back to + using ``count`` in its implementation. +- Due to an oversight, the ``count`` command was omitted from the Stable API in + server versions 5.0.0 - 5.0.7 and 5.1.0 - 5.3.1, so users of the Stable API + with estimatedDocumentCount are recommended to upgrade their MongoDB clusters + to 5.0.8 or 5.3.2 (if on Atlas) or set ``apiStrict: false`` when constructing + their MongoClients. ~~~~~~~~~~~~~~ countDocuments @@ -2354,9 +2363,13 @@ Q: Where is ``singleBatch`` in FindOptions? Q: Why are client-side errors raised for some unsupported options? Server versions before 3.4 were inconsistent about reporting errors for unrecognized command options and may simply ignore them, which means a client-side error is the only way to inform users that such options are unsupported. For unacknowledged writes using OP_MSG, a client-side error is necessary because the server has no chance to return a response (even though a 3.6+ server is otherwise capable of reporting errors for unrecognized options). For unacknowledged writes using legacy opcodes (i.e. OP_INSERT, OP_UPDATE, and OP_DELETE), the message body has no field with which to express these options so a client-side error is the only mechanism to inform the user that such options are unsupported. The spec does not explicitly refer to unacknowledged writes using OP_QUERY primarily because a response document is always returned and drivers generally would not consider using OP_QUERY precisely for that reason. +Q: Why does reverting to using ``count`` instead of ``aggregate`` with ``$collStats`` for estimatedDocumentCount not require a major version bump in the drivers, even though it might break users of the Stable API? + SemVer `allows `_ for a library to include a breaking change in a minor or patch version if the change is required to fix another accidental breaking change introduced in a prior version and is not expected to further break a large number of users. Given that the original switch to ``$collStats`` was a breaking change due to it not working on views, the number of users using estimatedDocumentCount with ``apiStrict: true`` is small, and the server is back-porting the addition of ``count`` to the Stable API, it was decided that this change was acceptable to make in minor version releases of the drivers per the aforementioned allowance in the SemVer spec. + Changes ======= +* 2022-04-21: Revert to using the ``count`` command for ``estimatedDocumentCount`` * 2022-02-18: Add let to BulkWriteOptions. * 2022-02-10: Specified that ``getMore`` command must explicitly send inherited comment. * 2022-02-01: Add comment attribute to all helpers. diff --git a/source/crud/tests/unified/estimatedDocumentCount-comment.json b/source/crud/tests/unified/estimatedDocumentCount-comment.json index d5601d76ec..e75dab50a8 100644 --- a/source/crud/tests/unified/estimatedDocumentCount-comment.json +++ b/source/crud/tests/unified/estimatedDocumentCount-comment.json @@ -47,65 +47,10 @@ ], "tests": [ { - "description": "estimatedDocumentCount with document comment - post 4.9", + "description": "estimatedDocumentCount with document comment", "runOnRequirements": [ { - "minServerVersion": "4.9.0" - } - ], - "operations": [ - { - "name": "estimatedDocumentCount", - "object": "collection0", - "arguments": { - "comment": { - "key": "value" - } - }, - "expectResult": 3 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll0", - "pipeline": [ - { - "$collStats": { - "count": {} - } - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": "$count" - } - } - } - ], - "comment": { - "key": "value" - } - }, - "commandName": "aggregate", - "databaseName": "edc-comment-tests" - } - } - ] - } - ] - }, - { - "description": "estimatedDocumentCount with document comment - pre 4.9", - "runOnRequirements": [ - { - "minServerVersion": "4.4.14", - "maxServerVersion": "4.8.99" + "minServerVersion": "4.4.14" } ], "operations": [ @@ -141,11 +86,10 @@ ] }, { - "description": "estimatedDocumentCount with string comment - pre 4.9", + "description": "estimatedDocumentCount with string comment", "runOnRequirements": [ { - "minServerVersion": "4.4.0", - "maxServerVersion": "4.8.99" + "minServerVersion": "4.4.0" } ], "operations": [ diff --git a/source/crud/tests/unified/estimatedDocumentCount-comment.yml b/source/crud/tests/unified/estimatedDocumentCount-comment.yml index 17782e8fdd..d0f7953976 100644 --- a/source/crud/tests/unified/estimatedDocumentCount-comment.yml +++ b/source/crud/tests/unified/estimatedDocumentCount-comment.yml @@ -24,39 +24,16 @@ initialData: - { _id: 3, x: 33 } tests: - - description: "estimatedDocumentCount with document comment - post 4.9" - runOnRequirements: - - minServerVersion: "4.9.0" - operations: - - name: estimatedDocumentCount - object: *collection0 - arguments: - comment: &documentComment { key: "value"} - expectResult: 3 - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - aggregate: *collection0Name - pipeline: &pipeline - - $collStats: { count: {} } - - $group: { _id: 1, n: { $sum: $count }} - comment: *documentComment - commandName: aggregate - databaseName: *database0Name - - - description: "estimatedDocumentCount with document comment - pre 4.9" + - description: "estimatedDocumentCount with document comment" runOnRequirements: # https://jira.mongodb.org/browse/SERVER-63315 # Server supports count with comment of any type for comment starting from 4.4.14. - minServerVersion: "4.4.14" - maxServerVersion: "4.8.99" operations: - name: estimatedDocumentCount object: *collection0 arguments: - comment: *documentComment + comment: &documentComment { key: "value"} expectResult: 3 expectEvents: - client: *client0 @@ -68,10 +45,9 @@ tests: commandName: count databaseName: *database0Name - - description: "estimatedDocumentCount with string comment - pre 4.9" + - description: "estimatedDocumentCount with string comment" runOnRequirements: - minServerVersion: "4.4.0" - maxServerVersion: "4.8.99" operations: - name: estimatedDocumentCount object: *collection0 diff --git a/source/crud/tests/unified/estimatedDocumentCount.json b/source/crud/tests/unified/estimatedDocumentCount.json index bcd66ea954..e148e214b4 100644 --- a/source/crud/tests/unified/estimatedDocumentCount.json +++ b/source/crud/tests/unified/estimatedDocumentCount.json @@ -58,288 +58,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 +84,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 +114,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 +140,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 +151,6 @@ }, { "minServerVersion": "4.2.0", - "maxServerVersion": "4.8.99", "topologies": [ "sharded" ] @@ -495,11 +202,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 +213,6 @@ }, { "minServerVersion": "4.2.0", - "maxServerVersion": "4.8.99", "topologies": [ "sharded" ] diff --git a/source/crud/tests/unified/estimatedDocumentCount.yml b/source/crud/tests/unified/estimatedDocumentCount.yml index c3286ec176..786b23bc95 100644 --- a/source/crud/tests/unified/estimatedDocumentCount.yml +++ b/source/crud/tests/unified/estimatedDocumentCount.yml @@ -31,129 +31,7 @@ initialData: - { _id: 3, x: 33 } 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: *collection0Name - pipeline: &pipeline - - $collStats: { count: {} } - - $group: { _id: 1, n: { $sum: $count }} - commandName: aggregate - databaseName: *database0Name - - - 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: *collection0Name - pipeline: &pipeline - - $collStats: { count: {} } - - $group: { _id: 1, n: { $sum: $count }} - maxTimeMS: 6000 - commandName: aggregate - databaseName: *database0Name - - - 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: *collection1Name - pipeline: &pipeline - - $collStats: { count: {} } - - $group: { _id: 1, n: { $sum: $count }} - commandName: aggregate - databaseName: *database0Name - - - 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 # UnknownError - - name: estimatedDocumentCount - object: *collection0 - expectError: - errorCode: 8 # UnknownError - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - aggregate: *collection0Name - pipeline: &pipeline - - $collStats: { count: {} } - - $group: { _id: 1, n: { $sum: $count }} - commandName: aggregate - databaseName: *database0Name - - - 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: *collection0Name - pipeline: &pipeline - - $collStats: { count: {} } - - $group: { _id: 1, n: { $sum: $count }} - commandName: aggregate - databaseName: *database0Name - - - description: "estimatedDocumentCount uses count on less than 4.9.0" - runOnRequirements: - - maxServerVersion: "4.8.99" + - description: "estimatedDocumentCount always uses count" operations: - name: estimatedDocumentCount object: *collection0 @@ -167,9 +45,7 @@ tests: commandName: count databaseName: *database0Name - - description: "estimatedDocumentCount with maxTimeMS on less than 4.9.0" - runOnRequirements: - - maxServerVersion: "4.8.99" + - description: "estimatedDocumentCount with maxTimeMS" operations: - name: estimatedDocumentCount object: *collection0 @@ -186,9 +62,7 @@ tests: commandName: count databaseName: *database0Name - - 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 object: *collection1 @@ -202,13 +76,11 @@ tests: commandName: count databaseName: *database0Name - - 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 ] - minServerVersion: "4.2.0" - maxServerVersion: "4.8.99" topologies: [ sharded ] operations: - name: failPoint @@ -234,13 +106,11 @@ tests: commandName: count databaseName: *database0Name - - 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 ] - minServerVersion: "4.2.0" - maxServerVersion: "4.8.99" topologies: [ sharded ] operations: - name: failPoint diff --git a/source/retryable-reads/tests/legacy/estimatedDocumentCount-4.9.json b/source/retryable-reads/tests/legacy/estimatedDocumentCount-4.9.json deleted file mode 100644 index a4c46fc074..0000000000 --- a/source/retryable-reads/tests/legacy/estimatedDocumentCount-4.9.json +++ /dev/null @@ -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" - } - } - ] - } - ] -} diff --git a/source/retryable-reads/tests/legacy/estimatedDocumentCount-4.9.yml b/source/retryable-reads/tests/legacy/estimatedDocumentCount-4.9.yml deleted file mode 100644 index 277ea010a4..0000000000 --- a/source/retryable-reads/tests/legacy/estimatedDocumentCount-4.9.yml +++ /dev/null @@ -1,60 +0,0 @@ -runOn: - - minServerVersion: "4.9.0" - -database_name: &database_name "retryable-reads-tests" -collection_name: &collection_name "coll" - -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - -tests: - - - description: "EstimatedDocumentCount succeeds on first attempt" - operations: - - &retryable_operation_succeeds - <<: &retryable_operation - name: estimatedDocumentCount - object: collection - result: 2 - expectations: - - &retryable_command_started_event - command_started_event: - command: - aggregate: *collection_name - pipeline: &pipeline - - $collStats: { count: {} } - - $group: { _id: 1, n: { $sum: $count }} - database_name: *database_name - - - description: "EstimatedDocumentCount succeeds on second attempt" - failPoint: &failCommand_failPoint - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: [aggregate] - closeConnection: true - operations: [*retryable_operation_succeeds] - expectations: - - *retryable_command_started_event - - *retryable_command_started_event - - - description: "EstimatedDocumentCount fails on first attempt" - clientOptions: - retryReads: false - failPoint: *failCommand_failPoint - operations: - - &retryable_operation_fails - <<: *retryable_operation - error: true - expectations: - - *retryable_command_started_event - - - description: "EstimatedDocumentCount fails on second attempt" - failPoint: - <<: *failCommand_failPoint - mode: { times: 2 } - operations: [*retryable_operation_fails] - expectations: - - *retryable_command_started_event - - *retryable_command_started_event diff --git a/source/retryable-reads/tests/legacy/estimatedDocumentCount-serverErrors-4.9.json b/source/retryable-reads/tests/legacy/estimatedDocumentCount-serverErrors-4.9.json deleted file mode 100644 index 756b02b3a8..0000000000 --- a/source/retryable-reads/tests/legacy/estimatedDocumentCount-serverErrors-4.9.json +++ /dev/null @@ -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" - } - } - ] - } - ] -} diff --git a/source/retryable-reads/tests/legacy/estimatedDocumentCount-serverErrors-4.9.yml b/source/retryable-reads/tests/legacy/estimatedDocumentCount-serverErrors-4.9.yml deleted file mode 100644 index 1a73d54312..0000000000 --- a/source/retryable-reads/tests/legacy/estimatedDocumentCount-serverErrors-4.9.yml +++ /dev/null @@ -1,146 +0,0 @@ -runOn: - - minServerVersion: "4.9.0" - -database_name: &database_name "retryable-reads-tests" -collection_name: &collection_name "coll" - -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - -tests: - - - description: "EstimatedDocumentCount succeeds after InterruptedAtShutdown" - failPoint: &failCommand_failPoint - configureFailPoint: failCommand - mode: { times: 1 } - data: { failCommands: [aggregate], errorCode: 11600 } - operations: - - &retryable_operation_succeeds - <<: &retryable_operation - name: estimatedDocumentCount - object: collection - result: 2 - expectations: - - &retryable_command_started_event - command_started_event: - command: - aggregate: *collection_name - pipeline: &pipeline - - $collStats: { count: {} } - - $group: { _id: 1, n: { $sum: $count }} - database_name: *database_name - - *retryable_command_started_event - - - description: "EstimatedDocumentCount succeeds after InterruptedDueToReplStateChange" - failPoint: - <<: *failCommand_failPoint - data: { failCommands: [aggregate], errorCode: 11602 } - operations: [*retryable_operation_succeeds] - expectations: - - *retryable_command_started_event - - *retryable_command_started_event - - - description: "EstimatedDocumentCount succeeds after NotWritablePrimary" - failPoint: - <<: *failCommand_failPoint - data: { failCommands: [aggregate], errorCode: 10107 } - operations: [*retryable_operation_succeeds] - expectations: - - *retryable_command_started_event - - *retryable_command_started_event - - - description: "EstimatedDocumentCount succeeds after NotPrimaryNoSecondaryOk" - failPoint: - <<: *failCommand_failPoint - data: { failCommands: [aggregate], errorCode: 13435 } - operations: [*retryable_operation_succeeds] - expectations: - - *retryable_command_started_event - - *retryable_command_started_event - - - description: "EstimatedDocumentCount succeeds after NotPrimaryOrSecondary" - failPoint: - <<: *failCommand_failPoint - data: { failCommands: [aggregate], errorCode: 13436 } - operations: [*retryable_operation_succeeds] - expectations: - - *retryable_command_started_event - - *retryable_command_started_event - - - description: "EstimatedDocumentCount succeeds after PrimarySteppedDown" - failPoint: - <<: *failCommand_failPoint - data: { failCommands: [aggregate], errorCode: 189 } - operations: [*retryable_operation_succeeds] - expectations: - - *retryable_command_started_event - - *retryable_command_started_event - - - description: "EstimatedDocumentCount succeeds after ShutdownInProgress" - failPoint: - <<: *failCommand_failPoint - data: { failCommands: [aggregate], errorCode: 91 } - operations: [*retryable_operation_succeeds] - expectations: - - *retryable_command_started_event - - *retryable_command_started_event - - - description: "EstimatedDocumentCount succeeds after HostNotFound" - failPoint: - <<: *failCommand_failPoint - data: { failCommands: [aggregate], errorCode: 7 } - operations: [*retryable_operation_succeeds] - expectations: - - *retryable_command_started_event - - *retryable_command_started_event - - - description: "EstimatedDocumentCount succeeds after HostUnreachable" - failPoint: - <<: *failCommand_failPoint - data: { failCommands: [aggregate], errorCode: 6 } - operations: [*retryable_operation_succeeds] - expectations: - - *retryable_command_started_event - - *retryable_command_started_event - - - description: "EstimatedDocumentCount succeeds after NetworkTimeout" - failPoint: - <<: *failCommand_failPoint - data: { failCommands: [aggregate], errorCode: 89 } - operations: [*retryable_operation_succeeds] - expectations: - - *retryable_command_started_event - - *retryable_command_started_event - - - description: "EstimatedDocumentCount succeeds after SocketException" - failPoint: - <<: *failCommand_failPoint - data: { failCommands: [aggregate], errorCode: 9001 } - operations: [*retryable_operation_succeeds] - expectations: - - *retryable_command_started_event - - *retryable_command_started_event - - - description: "EstimatedDocumentCount fails after two NotWritablePrimary errors" - failPoint: - <<: *failCommand_failPoint - mode: { times: 2 } - data: { failCommands: [aggregate], errorCode: 10107 } - operations: - - &retryable_operation_fails - <<: *retryable_operation - error: true - expectations: - - *retryable_command_started_event - - *retryable_command_started_event - - - description: "EstimatedDocumentCount fails after NotWritablePrimary when retryReads is false" - clientOptions: - retryReads: false - failPoint: - <<: *failCommand_failPoint - data: { failCommands: [aggregate], errorCode: 10107 } - operations: [*retryable_operation_fails] - expectations: - - *retryable_command_started_event diff --git a/source/retryable-reads/tests/legacy/estimatedDocumentCount-serverErrors-pre4.9.json b/source/retryable-reads/tests/legacy/estimatedDocumentCount-serverErrors.json similarity index 99% rename from source/retryable-reads/tests/legacy/estimatedDocumentCount-serverErrors-pre4.9.json rename to source/retryable-reads/tests/legacy/estimatedDocumentCount-serverErrors.json index 0b9a2615d1..6bb128f5f3 100644 --- a/source/retryable-reads/tests/legacy/estimatedDocumentCount-serverErrors-pre4.9.json +++ b/source/retryable-reads/tests/legacy/estimatedDocumentCount-serverErrors.json @@ -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" ] diff --git a/source/retryable-reads/tests/legacy/estimatedDocumentCount-serverErrors-pre4.9.yml b/source/retryable-reads/tests/legacy/estimatedDocumentCount-serverErrors.yml similarity index 98% rename from source/retryable-reads/tests/legacy/estimatedDocumentCount-serverErrors-pre4.9.yml rename to source/retryable-reads/tests/legacy/estimatedDocumentCount-serverErrors.yml index 99c343b889..aefb89ca69 100644 --- a/source/retryable-reads/tests/legacy/estimatedDocumentCount-serverErrors-pre4.9.yml +++ b/source/retryable-reads/tests/legacy/estimatedDocumentCount-serverErrors.yml @@ -1,11 +1,9 @@ runOn: - minServerVersion: "4.0" - maxServerVersion: "4.8.99" topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - maxServerVersion: "4.8.99" topology: ["sharded"] database_name: &database_name "retryable-reads-tests" diff --git a/source/retryable-reads/tests/legacy/estimatedDocumentCount-pre4.9.json b/source/retryable-reads/tests/legacy/estimatedDocumentCount.json similarity index 97% rename from source/retryable-reads/tests/legacy/estimatedDocumentCount-pre4.9.json rename to source/retryable-reads/tests/legacy/estimatedDocumentCount.json index 44be966ae7..8dfa15a2cd 100644 --- a/source/retryable-reads/tests/legacy/estimatedDocumentCount-pre4.9.json +++ b/source/retryable-reads/tests/legacy/estimatedDocumentCount.json @@ -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" ] diff --git a/source/retryable-reads/tests/legacy/estimatedDocumentCount-pre4.9.yml b/source/retryable-reads/tests/legacy/estimatedDocumentCount.yml similarity index 96% rename from source/retryable-reads/tests/legacy/estimatedDocumentCount-pre4.9.yml rename to source/retryable-reads/tests/legacy/estimatedDocumentCount.yml index d03a171d91..de03e483bb 100644 --- a/source/retryable-reads/tests/legacy/estimatedDocumentCount-pre4.9.yml +++ b/source/retryable-reads/tests/legacy/estimatedDocumentCount.yml @@ -1,11 +1,9 @@ runOn: - minServerVersion: "4.0" - maxServerVersion: "4.8.99" topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - maxServerVersion: "4.8.99" topology: ["sharded"] database_name: &database_name "retryable-reads-tests" diff --git a/source/versioned-api/tests/crud-api-version-1-strict.json b/source/versioned-api/tests/crud-api-version-1-strict.json index 29a0ec4e3b..02cb69812d 100644 --- a/source/versioned-api/tests/crud-api-version-1-strict.json +++ b/source/versioned-api/tests/crud-api-version-1-strict.json @@ -613,6 +613,15 @@ }, { "description": "estimatedDocumentCount appends declared API version", + "runOnRequirements": [ + { + "minServerVersion": "5.0.8", + "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": { diff --git a/source/versioned-api/tests/crud-api-version-1-strict.yml b/source/versioned-api/tests/crud-api-version-1-strict.yml index b5f3ac2d74..3e1a0cdbb6 100644 --- a/source/versioned-api/tests/crud-api-version-1-strict.yml +++ b/source/versioned-api/tests/crud-api-version-1-strict.yml @@ -229,6 +229,11 @@ tests: <<: *expectedApiVersion - description: "estimatedDocumentCount appends declared API version" + # See: https://jira.mongodb.org/browse/SERVER-63850 + runOnRequirements: + - minServerVersion: "5.0.8" + maxServerVersion: "5.0.99" + - minServerVersion: "5.3.2" operations: - name: estimatedDocumentCount object: *collection @@ -238,10 +243,7 @@ tests: events: - commandStartedEvent: command: - aggregate: *collectionName - pipeline: &pipeline - - $collStats: { count: {} } - - $group: { _id: 1, n: { $sum: $count }} + count: *collectionName <<: *expectedApiVersion - description: "find and getMore append API version" diff --git a/source/versioned-api/tests/crud-api-version-1.json b/source/versioned-api/tests/crud-api-version-1.json index 1f135eea18..ae852d8299 100644 --- a/source/versioned-api/tests/crud-api-version-1.json +++ b/source/versioned-api/tests/crud-api-version-1.json @@ -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.8", + "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 diff --git a/source/versioned-api/tests/crud-api-version-1.yml b/source/versioned-api/tests/crud-api-version-1.yml index d2fb5b9130..397419c477 100644 --- a/source/versioned-api/tests/crud-api-version-1.yml +++ b/source/versioned-api/tests/crud-api-version-1.yml @@ -222,7 +222,12 @@ tests: key: x <<: *expectedApiVersion - - description: "estimatedDocumentCount appends declared API version on 4.9.0 or greater" + - description: "estimatedDocumentCount appends declared API version" + # See: https://jira.mongodb.org/browse/SERVER-63850 + runOnRequirements: + - minServerVersion: "5.0.8" + maxServerVersion: "5.0.99" + - minServerVersion: "5.3.2" operations: - name: estimatedDocumentCount object: *collection @@ -232,10 +237,7 @@ tests: events: - commandStartedEvent: command: - aggregate: *collectionName - pipeline: &pipeline - - $collStats: { count: {} } - - $group: { _id: 1, n: { $sum: $count }} + count: *collectionName <<: *expectedApiVersion - description: "find and getMore append API version" diff --git a/source/wireversion-featurelist.rst b/source/wireversion-featurelist.rst index 8760022187..43521384fc 100644 --- a/source/wireversion-featurelist.rst +++ b/source/wireversion-featurelist.rst @@ -71,8 +71,7 @@ Server Wire version and Feature List * - 5.0 - 13 - - | Consistent $collStats count behavior on sharded and non-sharded topologies - | $out and $merge on secondaries (technically FCV 4.4+) + - | $out and $merge on secondaries (technically FCV 4.4+) * - 5.1 - 14