Lessons Learnt Building mongoengine



Recently, I attended both Pycon UK and Pycon Ireland to talk about the lessons I have learnt while maintaining mongoengine. The conferences were both excellent and surprisingly different. Pycon UK had quite an “unconference” feel, with some exciting sprint rooms - I wish I had more time as by all reports the educational jam was inspirational. Pycon Ireland in contrast felt more slick with booths from DemonWare, Amazon and Facebook. If you can, I’d advise going to both conferences as they really complement each other.

Going to python conferences its great to see ever increasing numbers of developers adopting MongoDB, its such a good fit for python! Also, I can’t tell you how great it is to have people come up and thank you and 10gen for creating such a great product. As a 10gen engineer one of our core goals is to build upon the power and ease of use of mongoDB.

Back to the matter at hand, here’s a quick overview of the talk. Please check out the slides for all the detail I glazed over here and for the extra keen you can even watch the video as well!

Lessons learnt building mongoengine

  1. Dive in!
    If a project is on Github its a license to dive in. Don’t be afraid to, but do be a good citizen and feedback changes to the root repository so others can benefit.

  2. Metaclasses
    Turns out they aren’t magical! In fact how we use them in mongoengine allows us to change the class and add metadata at declaration time. This really useful trick makes creating instances of classes quick and easy.

  3. Straying from the path
    Mongoengine uses a Django style query syntax. This is bad in that its different from the native pymongo syntax. But its also good as you we add some sweet syntactic sugar.

  4. Not all ideas are good
    In mongoDB the native save operation overwrites the whole document. This catches new users out. So in mongonengine save tracks changes to the document and uses atomic updates. The jury is out whether or not this is a good thing™.

  5. Managing a community
    I’ve never done it before and its not always easy but it has been worth it. My top tip is to check out the github network graph and ask committers to forks to add pull requests back upstream. In cases where people aren’t willing to do so add a ticket with a link to the feature you’ve spotted downstream. An added benefit of bubbling up these useful features is that it will bring more contributors into the core project.

  6. Don’t be afraid to ask for help
    Cue me asking for help on any aspect of mongoengine, be it the core, the website or framework support! Please get in contact


The video is available on the PyCon Ireland channel.