How to install MongoDB in Python
Hello Programmers. In this tutorial, we going to take a look at installing MongoDB in Python.
MongoDB provides its own software and we can also use MongoDB with python. Here we are going to take look on to download MongoDB using python which we will be using throughout this course. This tutorial will help to learn how to perform commands like insert, delete, update, modify and many other commands on the database.
We will require a user interface to keep track of our records. We will be using compass which a GUI provided by the MongoDB developers and it is quite easy to use it. I will also include the complete installation of the compass in this tutorial.
Firstly we will see what is MongoDB and then proceed to its installation process.
Install MongoDB in Python
MongoDB is an open-source document database. It is a NoSQL database. Well, this is quite simple. To install MongoDB using python we need to install a package called pymongo. Pymongo package consists of a class called MongoClient using which we create a connection between the MongoDB database and python.
PyMongo can be installed using pip. The following command is to be run in the command prompt.
python -m pip install pymono
Installing MongoDB Compass
For installing the Compass GUI visit the MongoDB Compass. This is the direct link to the downloading section so that you can directly start with downloading.
The steps to download the compass are as follows.
- By clicking on the given link you will be redirected to the MongoDB Compass download page.
- Select the latest stable version (it will be by default selected). You need to select the Platform which means the system of your computer. For windows, it requires a 64-bit OS. The windows users need to select Windows 64-bit (7+) MSI.
- This will start the downloading of the file which may take 10-20mins depending upon your internet speed.
- After completion of the file download open and Run it.
- The first page on installation will be welcome to the wizard page where you need to select Next.
- The next page is the destination folder which I recommend not to change and click on Next.
- And the last page is the installation page, here click on Install and it will successfully install the compass.
Also, read: How to get the size of a file in Python
Thank you guys for staying till the end. In the next tutorial, we will take a look at how to connect MongoDB using python.