MongoDB and Python

Patterns and Processes for the Popular Document-Oriented Database

Niall O'Higgins

Publisher: O'Reilly, 2011, 53 pages

ISBN: 978-1-449-31037-0

Keywords: Python, Databases

Last modified: Feb. 28, 2013, 3:18 p.m.

Learn how to leverage MongoDB with your Python applications, using the hands-on recipes in this book. You get complete code samples for tasks such as making fast geo queries for location-based apps, efficiently indexing your user documents for social-graph lookups, and many other scenarios.

This guide explains the basics of the document-oriented database and shows you how to set up a Python environment with it. Learn how to read and write to MongoDB, apply idiomatic MongoDB abd Python patterns, and use the database with several popular Python web frameworks. You'll discover how to model your data, write efficient queries, and avoid concurrency problems such as race conditions and deadlocks.

  1. Getting Started
    • Introduction
    • Finding Reference Documentation
    • Installing MongoDB
    • Running MongoDB
    • Setting up a Python Environment with MongoDB
  2. Reading and Writing to MongoDB with Python
    • Connecting to MongoDB with Python
    • Getting a Database Handle
    • Inserting a Document into a Collection
    • Write to a Collection Safely and Synchronously
    • Guaranteeing Writes to Multiple Database Nodes
    • Introduction to MongoDB Query Language
    • Reading, Counting, and Sorting Documents in a Collection
    • Updating Documents in a Collection
    • Deleting Documents in a Collection
    • MongoDB Query Operators
    • MongoDB Update Modifiers
  3. Common MongoDB and Python Patterns
    • A Uniquely Document-Oriented Pattern: Embedding
    • Fast Lookups: Using Indexes with MongoDB
    • Location-based Apps with MongoDB: GeoSpatial Indexing
    • Code Defensively to Avoid KeyErrors and Other Bugs
    • Update-or-Insert: Upserts in MongoDB
    • Atomic Read-Write-Modify: MongoDB's findAndModify
    • Fast Accounting Pattern
  4. MongoDB with Web Frameworks
    • Pylons 1.x and MongoDB
    • Pyramid and MongoDB
    • Django and MongoDB
    • Going Further


MongoDB and Python

Reviewed by Roland Buresund

Mediocre **** (4 out of 10)

Last modified: Feb. 28, 2013, 3:18 p.m.

Well, it is a stretch to say that the book lives up to its back-cover. Granted, it covers the subject, but in such a shallow manner that it is hardly worth reading the few pages it consists of.

You will not miss anything useful if you skip this book.


There are currently no comments

New Comment


required (not published)