python mongodb docker
client = MongoClient( host = ["ip:port"], username = "objectrocket", password = "1234", ) client.admin.command('ping')
Here is what the above code is Doing:
1. Importing the MongoClient class from the pymongo library.
2. Creating a MongoClient instance.
3. Connecting to the MongoDB instance.
4. Authenticating the user.
5. Pinging the MongoDB instance.