Deprecated 'name' arg for fields in favour of 'db_field'
This commit is contained in:
parent
047cc218a6
commit
25a0a5364a
7 changed files with 48 additions and 40 deletions
|
|
@ -21,7 +21,7 @@ Documents
|
|||
.. autoclass:: mongoengine.EmbeddedDocument
|
||||
:members:
|
||||
|
||||
.. autoclass:: mongoengine.MapReduceDocument
|
||||
.. autoclass:: mongoengine.document.MapReduceDocument
|
||||
:members:
|
||||
|
||||
Querying
|
||||
|
|
|
|||
|
|
@ -336,7 +336,7 @@ example)::
|
|||
return document.objects.exec_js(code, field_name, **options)
|
||||
|
||||
As fields in MongoEngine may use different names in the database (set using the
|
||||
:attr:`name` keyword argument to a :class:`Field` constructor), a mechanism
|
||||
:attr:`db_field` keyword argument to a :class:`Field` constructor), a mechanism
|
||||
exists for replacing MongoEngine field names with the database field names in
|
||||
Javascript code. When accessing a field on a collection object, use
|
||||
square-bracket notation, and prefix the MongoEngine field name with a tilde.
|
||||
|
|
@ -347,10 +347,10 @@ should be used before the name of the field on the embedded document. The
|
|||
following example shows how the substitutions are made::
|
||||
|
||||
class Comment(EmbeddedDocument):
|
||||
content = StringField(name='body')
|
||||
content = StringField(db_field='body')
|
||||
|
||||
class BlogPost(Document):
|
||||
title = StringField(name='doctitle')
|
||||
title = StringField(db_field='doctitle')
|
||||
comments = ListField(EmbeddedDocumentField(Comment), name='cs')
|
||||
|
||||
# Returns a list of dictionaries. Each dictionary contains a value named
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue