-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Execution
-
None
-
None
-
None
-
None
-
None
-
None
-
None
We have seen the following error after upgrading to Python 3.14. It is not clear to us what effect this could have, since the command being sent to the server is the same.
We have a test that runs an explain command on a database that may or may not exist. Previously it would always pass regardless of whether the database existed. The test only fails when a sharded cluster is involved. Server version or the use of auth or ssl does not seem to have an effect.
The test code looks like:
# Create a collection, referred to as collection, with the namespace explain-test.collection. collection = client["explain-test"]["collection"] # Run an explained find on collection. The find will have the query predicate { name: 'john doe' }. Specify a maxTimeMS value of 2000ms for the explain. with pymongo.timeout(2.0): self.assertTrue(collection.find({"name": "john doe"}).explain())
The failure we're now seeing is of the form: 'errmsg': 'database explain-test not found', 'code': 26, 'codeName': 'NamespaceNotFound'
Example failure with 5.0.31, Auth and SSL:
https://spruce.mongodb.com/task/mongo_python_driver_green_gevent_rhel8_test_standard_v5.0_pypy3.10_sync_auth_ssl_sharded_cluster_patch_ffb372aec73d119f03810c1d7816f6278fe14afe_68892239989c010007b1c0fa_25_07_29_19_34_38/logs?execution=0&sorts=STATUS%3AASC
Example failure with 7.0.22, No Auth and No SSL:
https://spruce.mongodb.com/task/mongo_python_driver_pyopenssl_win64_test_standard_v7.0_python3.14_sync_noauth_nossl_sharded_cluster_patch_ffb372aec73d119f03810c1d7816f6278fe14afe_68895b327ccfb20007338cdf_25_07_29_23_37_33/tests?execution=1&sorts=STATUS%3AASC
The messages for a successful test look like:
DEBUG pymongo.command:logger.py:108 {"message": "Command started", "clientId": {"$oid": "688958a2dd3e2442a0a96d57"}, "command": "{\"explain\": {\"find\": \"collection\", \"filter\": {\"name\": \"john doe\"}}, \"lsid\": {\"id\": {\"$binary\": {\"base64\": \"vu7xzC29TKCwhX+J6OrHjg==\", \"subType\": \"04\"}}}, \"$clusterTime\": {\"clusterTime\": {\"$timestamp\": {\"t\": 1753831585, \"i\": 1}}, \"signature\": {\"hash\": {\"$binary\": {\"base64\": \"78yFm9e23pbk3yyZCUzZEyDL9ZA=\", \"subType\": \"00\"}}, \"keyId\": 7532572901388582938}}, \"maxTimeMS\": 1968, \"$db\": \"explain-test\"}", "commandName": "explain", "databaseName": "explain-test", "requestId": 1108728549, "operationId": 1108728549, "driverConnectionId": 1, "serverConnectionId": 594, "serverHost": "localhost", "serverPort": 27017} DEBUG pymongo.command:logger.py:108 {"message": "Command succeeded", "clientId": {"$oid": "688958a2dd3e2442a0a96d57"}, "durationMS": 1.204, "reply": "{\"queryPlanner\": {\"winningPlan\": {\"stage\": \"SINGLE_SHARD\", \"shards\": [{\"explainVersion\": \"1\", \"shardName\": \"sh01\", \"connectionString\": \"0f16d36f-ac44-4217-807f-0acc7d6e8e4b/localhost:27217,localhost:27218,localhost:27219\", \"serverInfo\": {\"host\": \"M-N37FFKPQ79\", \"port\": 27218, \"version\": \"8.2.0-rc0-240-g00a05d1\", \"gitVersion\": \"00a05d1e77eb80e3f8c2e0fdd34a8488e79dae61\"}, \"namespace\": \"explain-test.collection\", \"parsedQuery\": {\"name\": {\"$eq\": \"john doe\"}}, \"queryHash\": \"F4DDDCDC\", \"planCacheShapeHash\": \"F4DDDCDC\", \"planCacheKey\": \"E45FBFA1\", \"winningPlan\": {\"stage\": \"COLLSCAN\", \"filter\": {\"name\": {\"$eq\": \"john doe\"}}, \"direction\": \"forward\"}}]}}, \"executionStats\": {\"executionStages\": {\"stage\": \"SINGLE_SHARD\", \"shards\": [{\"shardName\": \"sh01\", \"executionSuccess\": true, \"executionStages\": {\"stage\": \"COLLSCAN\", \"filter\": {\"name\": {\"$eq\": \"john doe\"}}, \"works\": 1, \"isEOF\": 1, \"direction\": \"forward\"}}]}, \"allPlansExecution\": [{\"shardName\": \"sh01\"}]}, \"queryShapeHash\": \"F94CBDBCB10F24D7F3F15F82715865C52218FCA0BB75A204DEE003340F4B6E07\", \"serverInfo\": {\"host\": \"M-N37FFKPQ79\", \"port\": 27017, \"version\": \"8.2.0-rc0-240-g00a05d1\", \"gitVersion\": \"00a05d1e77eb80e3f8c2e0fdd34a8488e79dae61\"}, \"serverParameters\": {\"internalQueryFacetBufferSizeBytes\": 104857600, \"internalQueryFacetMaxOutputDocSizeBytes\": 104857600, \"internalLookupStageIntermediateDocumentMaxSizeBytes\": 104857600, \"internalDocumentSourceGroupMaxMemoryBytes\": 104857600, \"internalQueryMaxBlockingSortMemoryUsageBytes\": 104857600, \"internalQueryMaxAddToSetBytes\": 104857600, \"internalDocumentSourceSetWindowFieldsMaxMemoryBytes\": 104857600, \"internalQueryFrameworkControl\": \"trySbeRestricted\", \"internalQueryPlannerIgnoreIndexWithCollationForRegex\": 1}, \"command\": {\"find\": \"collection\", \"filter\": {\"name\": \"john doe\"}, \"lsid\": {\"id\": {\"$binary\": {\"base64\": \"vu7xzC29TKCwhX+J6OrHjg==\", \"subType\": \"04\"}}}, \"$clusterTime\": {\"clusterTime\": {\"$timestamp\": {\"t\": 1753831585, \"i\": 1}}, \"signature\": {\"hash\": {\"$binary\": {\"base64\": \"78yFm9e...", "commandName": "explain", "databaseName": "explain-test", "requestId": 1108728549, "operationId": 1108728549, "driverConnectionId": 1, "serverConnectionId": 594, "serverHost": "localhost", "serverPort": 27017}
The messages for a failed test look like:
[2025/07/29 19:08:38.407] DEBUG {"message": "Command started", "clientId": {"$oid": "688960f016b2af8bb0b6b279"}, "command": "{\"explain\": {\"find\": \"collection\", \"filter\": {\"name\": \"john doe\"}}, \"lsid\": {\"id\": {\"$binary\": {\"base64\": \"tCIxDXCaSyWN43XeofqDdw==\", \"subType\": \"04\"}}}, \"$clusterTime\": {\"clusterTime\": {\"$timestamp\": {\"t\": 1753833712, \"i\": 39}}, \"signature\": {\"hash\": {\"$binary\": {\"base64\": \"AAAAAAAAAAAAAAAAAAAAAAAAAAA=\", \"subType\": \"00\"}}}}, \"maxTimeMS\": 1996, \"$db\": \"explain-test\"}", "commandName": "explain", "databaseName": "explain-test", "requestId": 1809172272, "operationId": 1809172272, "driverConnectionId": 1, "serverConnectionId": 7458, "serverHost": "localhost", "serverPort": 27017} [2025/07/29 19:08:38.407] DEBUG {"message": "Command failed", "clientId": {"$oid": "688960f016b2af8bb0b6b279"}, "durationMS": 1.571, "failure": "{\"code\": 26, \"codeName\": \"NamespaceNotFound\"}", "commandName": "explain", "databaseName": "explain-test", "requestId": 1809172272, "operationId": 1809172272, "driverConnectionId": 1, "serverConnectionId": 7458, "serverHost": "localhost", "serverPort": 27017}
- is related to
-
SERVER-87164 Explain for tracked and untracked unsharded collections return different stages
-
- Open
-
-
SERVER-43925 Proactively close newly empty databases
-
- Backlog
-