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

CSHARP-4053: Query no longer throws but it loads entire people collection into the pipeline. #1548

Closed
wants to merge 2 commits into from

Conversation

rstam
Copy link
Contributor

@rstam rstam commented Nov 18, 2024

No description provided.

@rstam rstam requested a review from a team as a code owner November 18, 2024 19:08
var stages = Translate(movies, queryable);
AssertStages(
stages,
"{ $project : { _v : { $map : { input : [{ _id : 1, MovieIds : [1, 2] }, { _id : 2, MovieIds : [2, 3] }], as : 'person', in : { movie : '$$ROOT', person : '$$person' } } }, _id : 0 } }",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that the entire people collection has been loaded into the pipeline as the input value.

results[0].ToJson().Should().Be("""{ "movie" : { "_id" : 1 }, "person" : { "_id" : 1, "MovieIds" : [1, 2] } }""");
results[1].ToJson().Should().Be("""{ "movie" : { "_id" : 2 }, "person" : { "_id" : 1, "MovieIds" : [1, 2] } }""");
results[2].ToJson().Should().Be("""{ "movie" : { "_id" : 2 }, "person" : { "_id" : 2, "MovieIds" : [2, 3] } }""");
results[3].ToJson().Should().Be("""{ "movie" : { "_id" : 3 }, "person" : { "_id" : 2, "MovieIds" : [2, 3] } }""");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The results look correct to me, but the query needs to be more efficient.

@rstam
Copy link
Contributor Author

rstam commented Nov 18, 2024

I'm thinking that the right thing to do is to create a new ticket for SelectMany saying that SelectMany should generate more efficient MQL when the collectionSelector is a MongoDB collection.

@rstam
Copy link
Contributor Author

rstam commented Nov 22, 2024

Investigation done. Ticket remains in backlog.

@rstam rstam closed this Nov 22, 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.

1 participant