Mongo ODM wroten in Python and based in pymongo client.
-
Installation TODO
-
Configuration TODO
-
Define your model
from pymongodm import Model, fields
class Post(Model): author = fields.StringField() body = fields.StringField() comments = fields.ListField(cls=Comment) tags = fields.ListField(cls=str)
class Comment(Model): author = fields.StringField() body = fields.StringField()
- Create some objects
post = Post(author = "Enrique Coslado") post.setattr("body", "Lorem Ipsum ...") post.getbody > "Lorem Ipsum ..."
post.save()