exec_js(code, *field_names, **options)
- fields − to be used in your function, which will be passed as arguments
In addition, some more variables are also made available to the function’s scope as given below −
- options − an object containing the keyword arguments passed into exec_js().
Note that attributes in MongoEngine document class may use different names in the database (set using the db_field keyword argument to a Field constructor).
from mongoengine import connect from mongoengine import StringField, IntField, Document, DecimalField, ListField connect('mydata', host='mongodb://localhost/mydata') class Books(Document): title = StringField(db_field='doctitle')
When accessing a field on a collection object, use square-bracket notation, and prefix the MongoEngine field name with a tilde (~) symbol. The field name that follows the tilde will be translated to the name used in the database.