Repository navigation
fix: hydrate references correctly across nested EmbeddedDocumentListFields - #10
Merged
arunsureshkumar merged 1 commit intoSep 20, 2026
Conversation
…ields A ReferenceField nested two EmbeddedDocumentListFields deep (e.g. integrations[].brands[].brand) crashed MongoDB with "$mergeObjects requires object inputs, but input [...] is of type array". The hydrate stage flattened the dotted path crossing both array levels into a single $map, so MongoDB handed it an array-of-arrays instead of a flat list of items. Thread a list_chain (per-array-level relative segments) alongside the existing embedded_list_path through _walk_lookups, and build nested $map/$mergeObjects stages matching the real document shape via a new _build_nested_list_hydrate_expr helper, shared by both the structured-ref and generic-ref embedded-list lookups.
harikrishnang33
deleted the
fix/nested-embedded-list-reference-hydrate
branch
September 21, 2026 05:34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ReferenceFieldnested twoEmbeddedDocumentListFields deep (e.g.integrations[].brands[].brand) crashed MongoDB with$mergeObjects requires object inputs, but input [...] is of type array, because the hydrate stage flattened the dotted path crossing both array levels into a single$map, handing MongoDB an array-of-arrays.list_chain(per-array-level relative segments) alongside the existingembedded_list_paththrough_walk_lookups, and builds nested$map/$mergeObjectsstages matching the real document shape via a new_build_nested_list_hydrate_exprhelper, shared by both the structured-ref and generic-ref embedded-list lookups.Test plan
uv run pytest tests/test_pipeline_builder.py -q— 8/8 passed, including a new regression test (test_doubly_nested_embedded_list_reference_hydrate) reproducing the exactintegrations[].brands[].brandshaperuff check/ruff format --check— no new issues introduced