mongoengine icon indicating copy to clipboard operation
mongoengine copied to clipboard

Fixes querying nested fields in dynamic embedded docs

Open m-revetria opened this issue 3 years ago • 0 comments

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:

  1. test_complex_embedded_document_query: before the change this test raises a LookUpError (the error in #2251)
  2. test_complex_embedded_document_with_aliased_field_query: this test shows up the query executed is not correct when a field in the DynamicEmbeddedDocument has defined a value for db_field.

m-revetria avatar Apr 21 '22 18:04 m-revetria