MongoDB is a document-oriented database program. It is NoSQL database and one of the most used databases nowadays. It provides a schema-less platform. Thereby suitable for evolving with time data.
We can work with MongoDb using Python. The native MongoDB driver for Python is PyMongo.
You can install PyMongo using the command
python -m pip install pymongo
Using the below given code we can connect MongoDB with Python.
from pymongo import MongoClient client = MongoClient('enter your connection string here') db = client.admin serverstatus = db.command('serverStatus') print(serverstatus)
We are connecting to our MongoDB instance. The ‘
db.serverStatus()‘ command returns information about our MongoDB instance