This week I bought Rick Copeland’s MongoDB with Python and Ming eBook from Amazon. It just came out in July 2012, so I figured I should check it out and see what all the fuss is with MongoDB and the whole NoSQL fad.

Quick Review

  • Why I picked it up: Mainly because I’ve been interested in MongoDB for a while, the book was reasonably priced and I’ve read a little of his SQLAlchemy book. I think I may have even met the guy at PyCon a couple years ago too.
  • Why I finished it: I almost always try to finish a book, especially if I’m going to review it. This one was hard though.
  • I’d give it to: Someone who needed a quick text to get them up to speed on MongoDB and Ming

Book Formats

As far as I can tell, this book is only available as an epub from Lulu or for the Kindle.

Book Contents

The book is approximately 84 pages in length. It contains 6 chapters. Chapters 1 and 2 are introductory in nature. Chapter 1 is your typical throwaway chapter with light descriptions of what will be covered and who the reader ought to be. Suffice it to say, if you don’t know Python already, this book won’t help you. It also won’t help you set up MongoDB. I’m actually surprised that chapter 1 wasn’t a Preface instead. Chapter 2 tells you to go setup MongoDB or use an online service such as MongoLab or MongoHQ. You also learn how to install pyMongo and use it to connect to MongoDB, insert data, run queries, create indexes, delete data, update data, learn to use GridFS, and aggregation in MongoDB (mapreduce, sharding, aggregation framework). Yes, chapter 2 is quite hefty. By the time you finish it, you’ll be almost halfway through the book!

Chapter 3 is on getting the best performance out of MongoDB and discusses upgrades to hardware versus sharding. Chapter 4 introduces Ming (not to be confused with MingW for Windows). Ming is basically an ORM (or ODM – Object Document Mapper) for MongoDB that was written by the people at SourceForge and than open-sourced. Chapter 4 covers Ming pretty thoroughly, including defining the schema imperatively and declaratively. It also covers a lot of the same ground that chapter 2 did (i.e. CRUD) but from a Ming / Session perspective. Chapter 5 builds on chapter 4 in that it talks about another abstract layer that Ming can provide which gives the developer the ability to have automatic persistence, an identity-map, a way to flush multiple updates at once and a few other things. Finally, chapter 6 is an odds and ends chapter containing stuff that didn’t fit anywhere else in the book (that’s the author’s words, not mine). It talks about various ways to enable database migration if the schema changes (such as using the flyaway module) and how to extend the ODM’s mapper.


The book starts out pretty well and the author writes in an engaging manner. However, by the end of chapter 2 I found myself bogged down by code example after code example. Normally that doesn’t bother me, but it feels a little repetitious at times and I feel like there isn’t enough explanation to go along with the source. I only tried a few of the examples out myself, but they seemed to work most of the time. Right before section 2.3, there is a typo in the code where the author uses a findOne() method that doesn’t exist. Instead, it should be find_one(). I tried to find out if pyMongo’s API had changed recently using Google, but I couldn’t find anything. Hopefully that is an isolated case, but as I said, I didn’t test a lot of the code.

The other issue with the book is that there are lots of weird little typos. Usually it’s just mis-spellings although occasionally there are some grammar issues. This is minor stuff, but most spell-checkers I’ve used would have caught the majority of them. There are a few spots where the author rambles a bit or the code sessions are a little hard to follow, but other than that, I thought the book was pretty good. Yes, it gets pretty dry by the end, but that’s true of most programming textbooks. If you are looking to join the legions of MongoDB programmers and you want to stick with Python, then this book should get you started. If you need more information, then MongoDB and Python: Patterns and processes for the popular document-oriented database by Niall O’Higgins might be helpful (note: I haven’t read that one yet).

MongoDB with Python and Ming

Rick Copeland


Print Friendly