Designing trees in mongodb using mongodm
08 Oct 2010
mongodm is a small API on top of pymongo that allowed to create user defined mongodb object documents.
All collection’s queries are still made using pymongo, mongodm just provide an nice way to create data structures and validation schemas.
The first reason that bring me away from the great mongoengine is that’s there’s no way to easily manage recursive trees.
Here are two tree pattern implementation using this small library.
Full Tree in Single Document
Materialized paths pattern
you can easily get back children using TreeDocument.children property.
I’m working on mongodm on my time off for a personnal project (this is one of my first python developments), so feel free to give me your feed back.