New MongoEngine Website
Check out our shiny new website at mongoengine.org
An object-document mapper to connect Python and MongoDB
MongoEngine is a Document-Object Mapper (think ORM, but for document databases) for working with MongoDB from Python. It uses a simple declarative API, similar to the Django ORM.
MongoEngine is a project from the Traction Digital labs.
from mongoengine import * # To define a schema for a
# document, we create a
class Metadata(EmbeddedDocument): # class that inherits from
tags = ListField(StringField()) # Document.
revisions = ListField(IntField()) #
# Fields are specified by
class WikiPage(Document): # adding field objects as
title = StringField(required=True) # class attributes to the
text = StringField() # document class.
metadata = EmbeddedDocumentField(Metadata) #
# Querying is achieved by
>>> page.title = “Hello, World!” # calling the objects
>>> for page in WikiPage.objects: # attribute on a document
>>> print page.title # class.
Check out our shiny new website at mongoengine.org
To install MongoEngine, simply run:
# easy_install -U mongoengine
Downloads are also available as .zip/.tar.gz archives for the stable and master versions.
To get to grips with MongoEngine, there is extensive documentation, API references and a tutorial. You can find help by joining the MongoEngine Users mailing list or by chatting with other users on the #mongoengine IRC channel.
If you are interested in contributing, join the developers’ mailing list.
The source code is available for download under the MIT License over at GitHub. To checkout the latest version using git, clone the main repository:
git clone git://github.com/hmarr/mongoengine.git
To contribute to the project, fork it on GitHub and send a pull request, all contributions and suggestions are welcome!