Learnmonkey Learnmonkey Logo
× Warning:

The tutorial you are reading is currently a work in-progress.

PyMongo Setup

Setting up a MongoDB Database

Before we can do anything, we of course need to set up a MongoDB database. There are two options. First, we could download ad MongoDB database onto our computer. The second option, and the one we'll go with, is hosting our database in the cloud. Luckily, MongoDB has a free plan that we can use for experimentation. To do this, go to https://www.mongodb.com/cloud/atlas and go through the options to set up a database.

Installing PyMongo

After making our database, we need to install the PyMongo Python module using PIP:

pip install pymongo
If PIP doesn't work, read our Troubleshooting PIP article.

After using PIP, run the following Python code to test if you installed it correctly:


import pymongo