This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

MongoLite is a fork of MongoKit by the same author. It aims to come back to simplicity by stripping a lot of features and replacing them with best practices.

The goal of MongoLite is to stick as much as possible to the pymongo api. MongoLite always choose speed over syntaxic sugar, this is why you won’t see validation or dot notation features in this project.

MongoLite is perfect for who wants a thin layer on top of pymongo and don’t care about validation stuff.

A mongolite is a beautiful stone

Your data is clean:

“Tools change, not data”. In order to follow this “credo”, just like MongoKit, MongoLite won’t add any information into your data saved into the database. So if you need to use other mongo tools or ODMs in other languages, your data won’t be polluted by MongoLite’s stuff.

Features

  • schema less feature
  • inheritance and polymorphisme support
  • skeleton generation (your object is automaticaly filled by the correct fields)
  • nested and complex schema declaration
  • default values features
  • random query support (which returns a random document from the database)
  • json helpers
  • GridFS support

A quick example

A Document declaration look like that:

>>> from mongolite import *
>>> import datetime

>>> connection = Connection()

>>> @connection.register
... class BlogPost(Document):
...     __database__ = 'test'
...     __collection__ = 'example'
...     skeleton = {
...             'title':unicode,
...             'body':unicode,
...             'author':unicode,
...             'date_creation':datetime.datetime,
...             'rank':int
...     }
...     optional = {
...             'tags': [unicode],
...     }
...     default_values = {'rank':0, 'date_creation':datetime.datetime.utcnow}
...

>>> blogpost = con.BlogPost() # this use the db "test" from `__database__` and the collection "example" from `__collection__`
>>> blogpost # the skeleton is automatically generated (based on the skeleton attribute)
{'body': None, 'title': None, 'date_creation': datetime.datetime(...), 'rank': 0, 'author': None}
>>> blogpost['title'] = u'my title'
>>> blogpost['body'] = u'a body'
>>> blogpost['author'] = u'me'
>>> blogpost['tags'] = ['about me', 'first post']
>>> blogpost
{'body': u'a body', 'title': u'my title', 'date_creation': datetime.datetime(...), 'rank': 0, 'author': u'me', 'tags': [u'about me', u'first post']}
>>> blogpost.save()

Note that, while fields in skeleton should be present in the document, fields in optional attribute are not generated by default. It aims to be for documentation only…

To access those fields, use the following convention:

for fields in skeleton:

>>> title = blogpost['title']

for fields in optional:

>>> tags = blogpost.get('tags', [])

MongoLite is written on top of pymongo. All the pymongo’s API is accessible and the results are wrapped into Document objects:

>>> blogpost = con.BlogPost.find_one() # this is a blogpost object

However, if you need more performances, you can use the pymongo layer directly:

>>> blogpost = con.test.example.find_one() # this is a dict

Suggestion and patches are really welcome. If you find mistakes in the documentation (english is not my primary langage) feel free to contact me. You can find me (namlook) on twitter.

Recent Change Log

v1.5

  • support pymongo 2.4

v1.4

  • support pymongo 2.3
  • added fix for unconditional access to __wrap on cursors
  • add __getitem__ suport on Cursor

v1.3

  • change pymongo.objectid -> bson.objectid as this alias was deleted in pymongo 2.2
  • add exception in case of bad behavior with inherited queries

v1.2

  • fix generate_indexes() and slightly api change

v1.1

  • add inherited queries support
  • add serialize support
  • fix pymongo’s version

v1.0

  • fork from MongoKit, strip all unwanted features
Release History

Release History

1.5

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0beta1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
MongoLite-1.5.tar.gz (32.0 kB) Copy SHA256 Checksum SHA256 Source Dec 11, 2012

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting