SwadhyAI Notes

All Python notes

MongoDB Getting Started ๐Ÿƒ

MongoDB Database

MongoDB is a NoSQL database. MongoDB stores data in JSON-like documents, which makes the database very flexible and scalable.

โœจ Install MongoDB Driver

Python needs a MongoDB driver to access the MongoDB database. We recommend that you use the driver "PyMongo".

Use PIP to install "PyMongo".

Terminal
pip install pymongo

๐Ÿงช Test PyMongo

To test if the installation was successful, or if you already have "PyMongo" installed, create a Python page with the following content.

python
import pymongo

If the above code was executed with no errors, "PyMongo" is installed and ready to be used.

๐Ÿ’ก Did You Know?

To be able to create a database or insert data you must have a running MongoDB instance.