No change required to upgrade to multiple databases. Aliases are used to describe the database and these can be manually registered or fall through to a default alias using connect. Made get_connection and get_db first class members of the connection class. Old style _get_connection and _get_db still supported. Refs: #84 #87 #93 #215
23 lines
434 B
Python
23 lines
434 B
Python
from datetime import datetime
|
|
|
|
from mongoengine import *
|
|
|
|
|
|
class PickleEmbedded(EmbeddedDocument):
|
|
date = DateTimeField(default=datetime.now)
|
|
|
|
|
|
class PickleTest(Document):
|
|
number = IntField()
|
|
string = StringField(choices=(('One', '1'), ('Two', '2')))
|
|
embedded = EmbeddedDocumentField(PickleEmbedded)
|
|
lists = ListField(StringField())
|
|
|
|
|
|
class Mixin(object):
|
|
name = StringField()
|
|
|
|
|
|
class Base(Document):
|
|
pass
|