0

I saw a lot of mongodb adapetrs for django but most of them doesn't support django 1.4 or have a different syntax from django orm. so, what's the best django mapper for 1.4 hopefully with the same syntax of django orm ?

tapioco123
  • 3,235
  • 10
  • 36
  • 42
  • If you are specifically fond of django ORM syntax, one option is to wait for the [django-nonrel fork](https://github.com/django-nonrel) to finish updating to django 1.4 (currently appears to be under development but the branch is not stable yet). Alternatively there are quite a few ORMs to choose from, eg: [Django-nonrel vs Django-mongodb vs Mongokit vs pymongo native](http://stackoverflow.com/questions/10424562/django-nonrel-vs-django-mongodb-vs-mongokit-vs-pymongo-native) – Stennie Sep 17 '12 at 06:42

1 Answers1

0

http://mongoengine.org/ looks pretty good

Here's what the syntax looks like:

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.
Jared Forsyth
  • 12,808
  • 7
  • 45
  • 54