Andre M
My feedback
2 results found
-
1 voteAndre M shared this idea ·
-
1 vote
An error occurred while saving the comment An error occurred while saving the comment Andre M commentedThanks for the response, Katya.
`$match` in my example isn't used as a replacement of the form with `localField`/`foreignField`, but because I need only those fields from the linked collection and this is the only way not to pull the entire linked object, but rather just fields required for this join.
In reality, only simple aggregation pipelines use the `localField`/`foreignField` form and in most cases the pipeline form would be used to control what's returned and how it is named via the projection.
The ask really is to recognize 1-to-1 joins or allow people to specify them explicitly, so one doesn't have to jump through the hoops manipulating all these sub-objects - it makes queries quite convoluted and also cannot be good for the server that needs multiple BSON operations to perform all those merges and unwinds.
Andre M shared this idea ·
Just wanted to add that in case if it wasn't very clear from my response, the original suggestion *does* use the `localField`/`foreignField` form where it's suitable, which only works for aggregating array sub-objects, such post comments or reviews.
What the suggestion does outline is that for 1-to-1 joins, which just need a few fields from the foreign collection and is a very common use case, the syntax becomes nightmarish and if Mongo DB would came up with a straightforward 1-to-1 join syntax, it would work very well for many Mongo DB users who want to use simple references, like we do in SQL, rather than having to update tens of thousands of denormalized documents, like we have to do today.
PS Can somebody please look at the broken Markdown formatting of these comments and the ridiculous 5-line window size on this site?