mongoengine
mongoengine copied to clipboard
Fixes querying nested fields in dynamic embedded docs
Changing field lookup for DynamicDocuments when the field is nested in a DynamicEmbeddedDocument.
Before these changes, the code was creating a dynamic field when the container document is a dynamic document regardless of the field being nested in an embedded document. In which case the field should be looked up there.
This PR fixes #2251.
There are two new tests that evidence this and another error:
- test_complex_embedded_document_query: before the change this test raises a
LookUpError(the error in #2251) - test_complex_embedded_document_with_aliased_field_query: this test shows up the query executed is not correct when a field in the
DynamicEmbeddedDocumenthas defined a value fordb_field.