MongoDB is a document-oriented NoSQL database that is often used for storing, querying and analyzing persistence data in Python applications.
It is worth taking some time to learn the ins and outs of MongoDB before connecting it to your Python application. The following tutorials are not specific to Python and will have you work directly with the MongoDB command line and query language.
Getting Started with MongoDB - Part 1
and
Part 2
are programming language agnostic tutorials that show how to interact
via querying and various operators such as $in
, $lte
and $gte
.
An Introduction to MongoDB examines common commands frequently used to perform data operations.
MongoDB In 30 Minutes goes over the basics for creating, querying, updating and deleting data in MongoDB.
MongoDB queries do not always return all matching documents! walks through discovering that potential pitfalls on how MongoDB queries operate that were non-intuitive to developers who are new to using this database.
On MongoDB is not a tutorial but instead discusses the culture and adoption patterns around how MongoDB became such a common NoSQL database. This is a must read to understand both the strengths and many weaknesses Mongo has despite what you may read in other introductory tutorials.
This 3-part series on monitoring MongoDB with WiredTiger MMAP and Datadog explains how to install and configure agents and gather metrics out of your MongoDB instances.
How to Investigate MongoDB Query Performance
shows how to work with the MongoDB profiler, use the explain
method
and check execution plans.
How to Optimize Performance of MongoDB covers schema design, replication lag, resource provisioning and query efficiency.
NoSQL databases can be a weak spot in a production deployment environment, especially when default settings are built for ease of development instead of proper access control. MongoDB is no exception with its loose default security controls so make sure to lock down your instances.
For God's sake, secure your Mongo/Redis/etc! explains the weak default security settings provided by many NoSQL databases, including MongoDB. Make sure to automate locking down your NoSQL databases just as you would any other component in your stack.
Before deploying a MongoDB instance to production, be sure to go through each of the items on the official MongoDB security checklist.
MongoDB Security Basics For Your Deployments in AWS is primarily a guide on AWS security from the perspective of using installing and using MongoDB on your own instance. The post covers authentication, SSL and firewalls.
Securing MongoDB using Let's Encrypt certificate gives a configuration that encrypts that traffic coming from and going to your MongoDB instances using free Let's Encrypt certificates.
This 4 post securing MongoDB series covers Data Security Requirements for Regulatory Compliance, Database Access Control, Database Auditing and Encryption and Environmental Control & Database Management.
Lightweight Directory Access Protocol (LDAP) is common in many established company environments for security. This post on How to Configure LDAP Authentication for MongoDB goes over how to authenticate users via LDAP who are using MongoDB.
MongoDB is straightforward to use in a Python application when a driver such as PyMongo is installed. The following tutorials show how to install, configure and start using MongoDB with Python.
Introduction to MongoDB and Python shows how to use Python to interface with MongoDB via PyMongo and MongoEngine.
A Gentle Introduction to MongoDB using Pymongo reviews a connection configuration file, the basics for data insertion, aggregation and updating records.
The PyMongo project creators wrote a retrospective focusing on four decisions they would have done differently with the benefit of hindsight:
Python and MongoDB on the Talk Python to Me podcast has a great interview with the MongoDB Python driver maintainer.
PyMongo Monday: Setting Up Your PyMongo Environment is an introduction to using MongoDB with Python code. This first part of the series shows how to set up the development environment required for working with Mongo.
Fix errors in your Python code before your users see them by monitoring with Rollbar.
Deploy web apps with the Ansible configuration management tool.
Build microservices with Docker, Flask & React in this great course.