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

#1008 Support for sub queries in $lookup #1228

Closed
wants to merge 4 commits into from

Conversation

telomir
Copy link

@telomir telomir commented Feb 8, 2018

This pull request aims to provide support for the new 3.6 sub-queries in the $lookup aggregation stage as documented in https://docs.mongodb.com/manual/reference/operator/aggregation/lookup/#join-conditions-and-uncorrelated-sub-queries. Test case is taken from the official documentation at: https://docs.mongodb.com/manual/reference/operator/aggregation/lookup/#join-conditions-and-uncorrelated-sub-queries

I was and still am really unsure about the interface because of the let parameter being just a BasicDBObject. It's usage came in quite handy for me, at least handier than a Map<String, String>. As I am not that deep into the depths of Morphia interfaces, I might have overlooked any similar interface where one would have to use a simple map. Happy to refactor that accordingly.

@telomir
Copy link
Author

telomir commented Feb 8, 2018

This feature could really profit from an implementation of $expr, but I could not yet wrap my head around it how to implement that with an easy-to-use interface and without writings tons of code today.

@telomir
Copy link
Author

telomir commented Feb 9, 2018

The test case should be refactored after #1229 is resolved.

@evanchooly
Copy link
Member

I've almost merged this twice before remembering about all the BasicDBObject bits in the API. It's not a clean API and the 2.x branch all but completely removes DBObject from every aspect of the API so I'm loathe to add a new instance here. The expression of the subqueries exposes too much of the inner workings for my taste, too, so I'd like to give that some thought as well. My gut tells me the current API, irrespective of this patch, doesn't provide the appropriate hooks to write a more user friendly API just yet.

@evanchooly evanchooly added this to the 2.0.0 milestone Jan 25, 2020
@evanchooly
Copy link
Member

This PR won't work with the new agg bits i'm wrapping up but this will help remind me to add these bits.

@evanchooly
Copy link
Member

This has been done in the new API. you can now specify a pipeline with the lookup stage.

@evanchooly evanchooly closed this Feb 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants