Welcome to tailow’s documentation!¶
Indices and tables¶
Why tailow ?¶
If you are looking for an Mongodb ORM with asyncio support. Then tailow serves good for you.
Connecting¶
from tailow import connect
connect("mongodb://username:password@localhost:27017/", "test", loop=<asyncio_loop>)
An optional loop keyword argument is added to support the explicit asyncio loop.
Defining Documents¶
from tailow.fields import *
from tailow.document import Document
class Student(Document):
id = IntegerField()
name = StringField()
age = IntegerField()
class Meta:
name = "students"
unique = ["id"]
Inherit the document class to define your own schemes. Document also support Meta attributes to further customize the Document and add indexes.
Meta Table properties¶
- indexes
- list represents the fields to be indexed
- unique
- list of fields which has unique indexes
- name
- alternate name of the collection