-
Type: Bug
-
Resolution: Unresolved
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: LangChain
-
None
-
Python Drivers
Detailed steps to reproduce the problem?
We set the level for either pymongo or pymongo.topology to logging.WARNING:
logging.getLogger("pymongo").setLevel(logging.WARNING)
logging.getLogger("pymongo.topology").setLevel(logging.WARNING)
Then we initiate a connection:
client = AsyncMongoClient("mongodb+srv://cluster-name.abcdef.mongodb.net/cxcatalog?retryWrites=true&w=majority&authMechanism=MONGODB-AWS&authSource=%24external", appname="microservice-name-async")
As soon as the connection is started, we see DEBUG level log messages which we are not expecting.
2024-10-23 22:05:12,894 [1] DEBUG pymongo.topology: {"topologyId": {"$oid": "6718ffeea90f5af2fca1ac69"}, "driverConnectionId": 45, "serverConnectionId": 610393, "serverHost": "cluster-name-shard-00-01.abcdef.mongodb.net", "serverPort": 27017, "awaited": true, "durationMS": 10126.029630017001, "reply": "{\"topologyVersion\": {\"processId\": {\"$oid\": \"6714bb4b9d04c677aa538c8c\"}, \"counter\": 5}, \"hosts\": [\"cxc-mongodb-cluster-dev-shard-00-00.qfsfn.mongodb.net:27017\", \"cluster-name-shard-00-01.abcdef.mongodb.net:27017\", \"cluster-name-shard-00-02.abcdef.mongodb.net:27017\"], \"setName\": \"atlas-purru6-shard-0\", \"setVersion\": 4, \"isWritablePrimary\": true, \"primary\": \"cluster-name-shard-00-01.abcdef.mongodb.net:27017\", \"tags\": {\"nodeType\": \"ELECTABLE\", \"diskState\": \"READY\", \"region\": \"********\", \"provider\": \"AWS\", \"workloadType\": \"OPERATIONAL\", \"availabilityZone\": \"use1-az1\"}, \"me\": \"cluster-name-shard-00-01.abcdef.mongodb.net:27017\", \"electionId\": {\"$oid\": \"7fffffff00000000000003b6\"}, \"lastWrite\": {\"opTime\": {\"ts\": {\"$timestamp\": {\"t\": 1729721105, \"i\": 1}}, \"t\": 950}, \"lastWriteDate\": {\"$date\": \"2024-10-23T22:05:05Z\"}, \"majorityOpTime\": {\"ts\": {\"$timestamp\": {\"t\": 1729721105, \"i\": 1}}, \"t\": 950}, \"majorityWriteDate\": {\"$date\": \"2024-10-23T22:05:05Z\"}}, \"max...", "message": "Server heartbeat succeeded"} 2024-10-23 22:05:12,896 [1] DEBUG pymongo.topology: {"topologyId": {"$oid": "6718ffeea90f5af2fca1ac69"}, "driverConnectionId": 45, "serverConnectionId": 610393, "serverHost": "cluster-name-shard-00-01.abcdef.mongodb.net", "serverPort": 27017, "awaited": true, "message": "Server heartbeat started"}
Definition of done: what must be done to consider the task complete?
After setting the log level to warning, only warning level or above messages should be printed. No DEBUG or INFO level messages should be shown.
The exact Python version used, with patch level:
$ python -c "import sys; print(sys.version)"
3.11.10 (main, Oct 19 2024, 03:39:30) [GCC 12.2.0]
The exact version of PyMongo used, with patch level:
$ python -c "import pymongo; print(pymongo.version); print(pymongo.has_c())"
4.10.1
True
Describe how MongoDB is set up. Local vs Hosted, version, topology, load balanced, etc.
MongoDB Atlas
The operating system and version (e.g. Windows 7, OSX 10.8, ...)
Python 3.11 Docker container running on Linux
Web framework or asynchronous network library used, if any, with version (e.g. Django 1.7, mod_wsgi 4.3.0, gevent 1.0.1, Tornado 4.0.2, ...)
FastAPI 0.115.3
Security Vulnerabilities
If you've identified a security vulnerability in a driver or any other MongoDB project, please report it according to the instructions here