[CSHARP-1775] Support Left Outer Joins Created: 04/Oct/16 Updated: 08/Feb/23 |
|
| Status: | Backlog |
| Project: | C# Driver |
| Component/s: | Linq |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Dan Cumings | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 7 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
example:
creates
The query does not work because of the seemingly useless unwind statement
|
| Comments |
| Comment by Daniel Schlieckmann [ 17/Oct/19 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Craig any news? I would like to have this feature implemented, i dont like implementing a workaround for it | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Carlos Solano [ 30/Aug/19 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I would love to have this feature, any workarounds for now?? | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Ed Lomonaco [ 22/Jan/19 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
that'd be great to see fixed | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Dan Cumings [ 22/Jan/19 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
This appears to still be broken. Any plans on getting this working? Any workarounds? | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Craig Wilson [ 02/Nov/16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Daniel, The "join" keyword implies an inner join. $unwind will eliminate the right side where there are no items in the array. To do a left outer join, you need to follow with a from joined.DefaultIfEmpty().
This will get you a left outer join. However, it appears as though we still don't include the proper "includeNullAndEmptyArrays" in the $unwind stage. So, for now, Left Joins simply aren't supported. I'll convert this into a feature request. Thanks for reporting, | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Dan Cumings [ 05/Oct/16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Basically the: $unwind need to be changed so it includes null arrays(new in Mongo 3.2) .
I had to re-arrange the pipeline in my case so that $unwind happend directly after the $lookup.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Dan Cumings [ 04/Oct/16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I stripped out too much the actual working sample would look like this:
is
|