mongoengine 0.9.0

MongoEngine is a Python Object-Document Mapper for working with MongoDB.

About

MongoEngine is a Python Object-Document Mapper for working with MongoDB. Documentation available at http://mongoengine-odm.rtfd.org - there is currently a tutorial, a user guide and an API reference.

Installation

If you have setuptools you can use easy_install -U mongoengine. Otherwise, you can download the source from GitHub and run python setup.py install.

Dependencies

  • pymongo>=2.7.1
  • sphinx (optional - for documentation generation)

Optional Dependencies

  • Django Integration: Django>=1.4.0 for Python 2.x or PyPy and Django>=1.5.0 for Python 3.x
  • Image Fields: Pillow>=2.0.0 or PIL (not recommended since MongoEngine is tested with Pillow)
  • dateutil>=2.1.0

Examples

Some simple examples of what MongoEngine code looks like:

class BlogPost(Document):
    title = StringField(required=True, max_length=200)
    posted = DateTimeField(default=datetime.datetime.now)
    tags = ListField(StringField(max_length=50))

class TextPost(BlogPost):
    content = StringField(required=True)

class LinkPost(BlogPost):
    url = StringField(required=True)

# Create a text-based post
>>> post1 = TextPost(title='Using MongoEngine', content='See the tutorial')
>>> post1.tags = ['mongodb', 'mongoengine']
>>> post1.save()

# Create a link-based post
>>> post2 = LinkPost(title='MongoEngine Docs', url='hmarr.com/mongoengine')
>>> post2.tags = ['mongoengine', 'documentation']
>>> post2.save()

# Iterate over all posts using the BlogPost superclass
>>> for post in BlogPost.objects:
...     print '===', post.title, '==='
...     if isinstance(post, TextPost):
...         print post.content
...     elif isinstance(post, LinkPost):
...         print 'Link:', post.url
...     print
...

>>> len(BlogPost.objects)
2
>>> len(HtmlPost.objects)
1
>>> len(LinkPost.objects)
1

# Find tagged posts
>>> len(BlogPost.objects(tags='mongoengine'))
2
>>> len(BlogPost.objects(tags='mongodb'))
1

Tests

To run the test suite, ensure you are running a local instance of MongoDB on the standard port, and run: python setup.py test.

Contributing

We welcome contributions! see the Contribution guidelines

MIT

Author

Ross Lawley

Pip

mongoengine==0.9.0

Classifiers

  • Topic :: Software Development :: Libraries :: Python Modules
  • Topic :: Database
  • Programming Language :: Python :: Implementation :: PyPy
  • Programming Language :: Python :: Implementation :: CPython
  • Programming Language :: Python :: 3.4
  • Programming Language :: Python :: 3.3
  • Programming Language :: Python :: 3.2
  • Programming Language :: Python :: 3
  • Programming Language :: Python :: 2.7
  • Programming Language :: Python :: 2.6
  • Programming Language :: Python :: 2
  • Programming Language :: Python
  • Operating System :: OS Independent
  • License :: OSI Approved :: MIT License
  • Intended Audience :: Developers
  • Development Status :: 4 - Beta
File Type Python Version Uploaded On Downloads
mongoengine-0.9.0.tar.gz Source March 28, 2015 14,299
Version Release Date
0.9.0 March 28, 2015
0.8.8 April 8, 2015
0.8.7 April 8, 2015
0.8.6 Dec. 4, 2013
0.8.5 Dec. 4, 2013
0.8.4 Aug. 23, 2013
0.8.3 Aug. 23, 2013
0.8.2 Aug. 23, 2013
0.8.1 Aug. 23, 2013
0.8.0 Aug. 23, 2013
0.7.10 Aug. 23, 2013
0.7.9 Aug. 23, 2013
0.7.8 Aug. 23, 2013
0.7.5 Aug. 23, 2013
0.7.4 Aug. 23, 2013
0.7.3 Aug. 23, 2013
0.7.2 Aug. 23, 2013
0.7.1 Aug. 23, 2013
0.7.0 Aug. 23, 2013
0.6.20 Aug. 23, 2013
0.6.19 Aug. 23, 2013
0.6.17 Aug. 23, 2013
0.6.16 Aug. 23, 2013
0.6.15 Aug. 23, 2013
0.6.13 Aug. 23, 2013
0.6.12 Aug. 23, 2013
0.6.10 Aug. 23, 2013
0.6.8 Aug. 23, 2013
0.6.7 Aug. 23, 2013
0.6.6 Aug. 23, 2013
0.6.4 Aug. 23, 2013
0.6.3 Aug. 23, 2013
0.6.1 Aug. 23, 2013
0.5.2 Aug. 23, 2013
0.5.1 Aug. 23, 2013
0.5 Aug. 23, 2013
0.4 Aug. 23, 2013
Date Package Version Action
April 18, 2015, 6:48 p.m. mongoengine 0.6.15 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.6.16 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.6.17 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.6.10 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.6.12 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.6.13 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.6.19 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.6.1 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.8.2 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.8.3 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.8.0 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.8.1 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.8.6 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.8.7 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.8.4 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.8.5 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.8.8 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.9.0 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.5.2 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.5.1 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.6.20 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.7.10 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.7.1 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.7.0 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.7.3 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.7.2 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.7.5 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.7.4 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.6.3 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.7.9 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.7.8 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.6.8 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.6.4 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.6.6 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.4 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.5 Release Created
April 18, 2015, 6:48 p.m. mongoengine 0.6.7 Release Created
April 18, 2015, 6:48 p.m. mongoengine Package Created