Skip to content

Fix db_field conflict bug - #2171

Open
shblhy wants to merge 4 commits into
MongoEngine:masterfrom
shblhy:master
Open

Fix db_field conflict bug#2171
shblhy wants to merge 4 commits into
MongoEngine:masterfrom
shblhy:master

Conversation

@shblhy

@shblhy shblhy commented Oct 2, 2019

Copy link
Copy Markdown

this code will trigger a bug in 0.18.2 version, so i fix it.

class Person(Document):
     name = StringField(required=True)
     age = IntField(required=False, db_field="gregorian_age")
     lunar_age = IntField(required=False, db_field="age")

@shblhy

shblhy commented Oct 5, 2019

Copy link
Copy Markdown
Author

I meet an error test case.
when use EmbeddedDocumentField, when we need change it from dict to python object, we need use dict like pymongo son, use attribute named as db_field, but not python object.This is because EmbeddedDocumentField use _from_json to change a dict to python object, and _from_json method use pymong son as input params.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant