O'Reilly logo

MongoDB Cookbook by Amol Nayak

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Executing update and delete operations using PyMongo

In the previous recipe, we saw how to execute find and insert operations in MongoDB using PyMongo. In this recipe, we will see how updates and deletions work from Python. We will also see what atomic find and update/delete is and how to execute these operations. We will then conclude by revisiting find operations and look at some interesting functions of the cursor object.

Getting ready

If you have already seen and completed the previous recipe, you are all set to go. If not, it is recommended that you first complete the previous recipe before going ahead with this recipe.

Before we get started, let's define a small function that iterates through the cursor and shows the results of a cursor on ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required