How To Install And Use The MongoEngine Wrapper For PyMongo

Introduction When you’re working with Python and MongoDB, you want your code to be as clean and elegant as possible. Using MongoEngine can help you write code that’s easy to read and maintain. The MongoEngine Python library is a light-weight wrapper for PyMongo, which is the Python MongoDB driver. This library allows users to update … Continued

How To Create and Setup a MongoDB Collection in Python

Introduction This tutorial will explain how to create a collection in MongoDB database using the Python PyMongo driver and provide examples of working with PYMongo collations, PYMongo collections and Python MongoDB collections. PYMongo collections are a group of documents saved in a MongoDB database, similar to a table in a SQL database. PyMongo is a … Continued

How to Query MongoDB Documents with Regex in Python

Introduction When you query a database, you’re not always looking for an exact string match. You might be querying a collection of store inventory for all items that have “Cookies” as some part of their name, or perhaps you’re searching for a person’s last name that begins with “Sch”, though you’re not sure exactly how … Continued

How To Delete MongoDB Documents Using Python

Introduction Delete MongoDB documents PyMongo is an important part of your regular maintenance routine for your MongoDB collections. As you add, modify, and analyze stored data, it becomes even more essential to clean out the clutter and remove MongoDB documents Python. The more organized your collections are, the easier it may become for you to … Continued

How to Update a MongoDB Document in Python

Introduction If you’re storing data in MongoDB, you’ll probably need to update documents from time to time. Fortunately, the PyMongo library makes it easy to get the job done with a simple Python script. Using PyMongo, your script can update a MongoDB document in a collection and have it return a results object containing the … Continued

How to Update Multiple MongoDB Documents in Python

Introduction If you use MongoDB to store and manage your data, there will be many times when you need to update multiple documents in a collection at once. In the past, the only method available to accomplish this was the update() method– you would need to use the multi flag with this method to change … Continued

How To Create an Index for a MongoDB Collection in Python

Introduction If you want to improve your query performance, it can be helpful to create indexes for your MongoDB collections. Indexes help make query requests more efficient because they store data in a way that makes it quick and easy to traverse. With the help of an index, MongoDB can locate documents that match your … Continued

How To Delete MongoDB Collections Using Python

Introduction When you need to delete a collection in MongoDB, it’s important to proceed with caution, because deleting is a permanent operation– the entire collection, and all of its documents, will be removed. Fortunately, it’s easy to delete collections in Python using the PyMongo driver. In this article, we’ll show two different methods that can … Continued

Keep in the know!

Subscribe to our emails and we’ll let you know what’s going on at ObjectRocket. We hate spam and make it easy to unsubscribe.