Mongoengine: AttributeError: DictField object has no attribute 'get'

Created on 18 Jan 2015  路  2Comments  路  Source: MongoEngine/mongoengine

import mongoengine as mg

class Team(mg.Document):
    # ......
    meta = mg.DictField()
Traceback (most recent call last):
  File "api.py", line 10, in <module>
    from models import *
  File "/Users/j/Source/ColorCommentary/models.py", line 11, in <module>
    class Team(mg.Document):
  File "/Users/j/.virtualenvs/colorcommentary/lib/python2.7/site-packages/mongoengine/base/metaclasses.py", line 260, in __new__
    attrs['_meta']['abstract'] = attrs['_meta'].get('abstract', False)
AttributeError: 'DictField' object has no attribute 'get'

Most helpful comment

What are the chances that I would exactly create a meta field with DictField and end up seeing this issue 5 years later :)

All 2 comments

Nevermind. tl;dr don't use probably-reserved words as column names, derp. Changing the field to team_meta did the job.

What are the chances that I would exactly create a meta field with DictField and end up seeing this issue 5 years later :)

Was this page helpful?
0 / 5 - 0 ratings