Setting up Your PyMongo Environment

This article was originally published on MongoDB. Thank you for supporting the partners who make SitePoint possible.

In this article, we’ll introduce developers to programming MongoDB using the Python programming language. PyMongo is the name of the client library (in MongoDB speak we refer to it as a “driver”) we use to interact with the MongoDB Server.

To get started we need to install the toolchain used by a typical MongoDB Python developer.

Installing m

First up is m. Hard to find online unless your search for “MongoDB m”, m is a tool to manage and use multiple installations of the MongoDB Server in parallel. It is an invaluable tool if you want to try out the latest and greatest beta version but still continue mainline development on our current stable release.

The easiest way to install m is with npm the Node.js package manager (which it turns out is not just for Node.js).

$ sudo npm install -g m
Password:******
/usr/local/bin/m -> /usr/local/lib/node_modules/m/bin/m
+ m@1.4.1
updated 1 package in 2.361s
$

If you can’t or don’t want to use npm, you can download and install directly from the GitHub repo. See the README there for details.

For today we will use m to install the current stable production version (4.0.2 at the time of writing).

We run the stable command to achieve this.

The post Setting up Your PyMongo Environment appeared first on SitePoint.

Powered by WPeMatico

The featured image was randomly selected. It is an unlikely coincidence if it is related to the post.