@@ -22,7 +22,7 @@ objects** as class attributes to the document class::
2222
2323 class Page(Document):
2424 title = StringField(max_length=200, required=True)
25- date_modified = DateTimeField(default=datetime.datetime.now )
25+ date_modified = DateTimeField(default=datetime.datetime.utcnow )
2626
2727As BSON (the binary format for storing data in mongodb) is order dependent,
2828documents are serialized based on their field order.
@@ -80,13 +80,15 @@ are as follows:
8080* :class: `~mongoengine.fields.FloatField `
8181* :class: `~mongoengine.fields.GenericEmbeddedDocumentField `
8282* :class: `~mongoengine.fields.GenericReferenceField `
83+ * :class: `~mongoengine.fields.GenericLazyReferenceField `
8384* :class: `~mongoengine.fields.GeoPointField `
8485* :class: `~mongoengine.fields.ImageField `
8586* :class: `~mongoengine.fields.IntField `
8687* :class: `~mongoengine.fields.ListField `
8788* :class: `~mongoengine.fields.MapField `
8889* :class: `~mongoengine.fields.ObjectIdField `
8990* :class: `~mongoengine.fields.ReferenceField `
91+ * :class: `~mongoengine.fields.LazyReferenceField `
9092* :class: `~mongoengine.fields.SequenceField `
9193* :class: `~mongoengine.fields.SortedListField `
9294* :class: `~mongoengine.fields.StringField `
@@ -224,7 +226,7 @@ store; in this situation a :class:`~mongoengine.fields.DictField` is appropriate
224226 user = ReferenceField(User)
225227 answers = DictField()
226228
227- survey_response = SurveyResponse(date=datetime.now (), user=request.user)
229+ survey_response = SurveyResponse(date=datetime.utcnow (), user=request.user)
228230 response_form = ResponseForm(request.POST)
229231 survey_response.answers = response_form.cleaned_data()
230232 survey_response.save()
@@ -526,8 +528,9 @@ There are a few top level defaults for all indexes that can be set::
526528 meta = {
527529 'index_options': {},
528530 'index_background': True,
531+ 'index_cls': False,
532+ 'auto_create_index': True,
529533 'index_drop_dups': True,
530- 'index_cls': False
531534 }
532535
533536
@@ -540,6 +543,12 @@ There are a few top level defaults for all indexes that can be set::
540543:attr: `index_cls ` (Optional)
541544 A way to turn off a specific index for _cls.
542545
546+ :attr: `auto_create_index ` (Optional)
547+ When this is True (default), MongoEngine will ensure that the correct
548+ indexes exist in MongoDB each time a command is run. This can be disabled
549+ in systems where indexes are managed separately. Disabling this will improve
550+ performance.
551+
543552:attr: `index_drop_dups ` (Optional)
544553 Set the default value for if an index should drop duplicates
545554
@@ -618,7 +627,7 @@ collection after a given period. See the official
618627documentation for more information. A common usecase might be session data::
619628
620629 class Session(Document):
621- created = DateTimeField(default=datetime.now )
630+ created = DateTimeField(default=datetime.utcnow )
622631 meta = {
623632 'indexes': [
624633 {'fields': ['created'], 'expireAfterSeconds': 3600}
0 commit comments