Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix db_field conflict bug #2171

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Fix db_field conflict bug #2171

wants to merge 4 commits into from

Conversation

shblhy
Copy link

@shblhy shblhy commented Oct 2, 2019

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
Copy link
Author

shblhy commented Oct 5, 2019

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