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 update and delete work in Python. We will also see what atomic find and update/delete is and how to execute them. We then conclude by revisiting find operations and looking 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 that recipe before going ahead with this one. Additionally, if you are not sure what read preference and write concern are, refer to the two recipes, Read preference for querying and Write concern and ...

Get MongoDB Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.