-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use concise correlated subquery syntax for relations with single colu…
…mn mapping (#65) This generates a simpler query plan when there is only one column mapping. Previously a `$lookup` looked like this: ```json { "$lookup": { "from": "students", "let": { "v__id": "$_id" }, "pipeline": [ { "$match": { "$expr": { "$eq": ["$$v__id", "$classId"] } } }, { "$replaceWith": { "student_name": { "$ifNull": ["$name", null] }, }, } ], "as": "students", }, }, ``` After the change it looks like this: ```json { "$lookup": { "from": "students", "localField": "_id", "foreignField": "classId", "pipeline": [ { "$replaceWith": { "student_name": { "$ifNull": ["$name", null] }, }, } ], "as": "students", }, }, ``` Cases with multiple column mappings still use the first form.
- Loading branch information
Showing
2 changed files
with
59 additions
and
60 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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