Collection is the base class
This class map a mongo collection into a python class. You only need to write a class and starts to use the orm advantages.
For example, a simple users collection can be mapping using:
>>> from mongotor.orm import collection, field
>>> class Users(collection.Collection):
>>> __collection__ = 'users'
>>> name = field.StringField()
Save a document
>>> user = Users()
>>> user.name = 'should be name'
>>> user.save()
Parameters: |
|
---|
Remove a document
Parameters: |
---|
Update a document
Parameters: |
---|