Skip to content

Conversation

@JamesKovacs
Copy link
Contributor

When fluently building a projection, each call to Include or Exclude creates a new CombinedProjectionDefinition<T> with the projection to that point and the new include/exclude projection. This results in a chain of nested projections. When this chain is rendered, CombinedProjectionDefinition<T>.Render is called recursively. With a large number of included/excluded fields, this can result in significant callstack depth. Although it is unlikely in common cases to overflow the stack, it is possible as demonstrated by the test case. This issue was resolved by flattening nested CombinedProjectionDefinition<T> instances.

@JamesKovacs JamesKovacs requested a review from a team as a code owner May 30, 2024 22:48
Copy link
Member

@sanych-sun sanych-sun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JamesKovacs JamesKovacs merged commit 3384185 into mongodb:master May 31, 2024
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.

2 participants