[CSHARP-1486] Support $$ROOT in LINQ for agg Created: 23/Nov/15 Updated: 02/Nov/21 Resolved: 02/Nov/21 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | Linq |
| Affects Version/s: | 2.1.1 |
| Fix Version/s: | 2.14.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Carlos Casanova | Assignee: | Robert Stam |
| Resolution: | Done | Votes: | 2 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Windows, C#, MongoDB 3.0.7 |
||
| Issue Links: |
|
||||||||||||
| Description |
|
The expected behavior of GroupBy method on LINQ is to return a IGrouping<TKey,TDocument>, where TKey is the group key type and TDocument is a IEnumerable<TDocument>. In this case it returns an empty IEnumerable. Is this the expected behavior? Becasue this in not the expected in other LINQ implementations. |
| Comments |
| Comment by Robert Stam [ 02/Nov/21 ] | ||||
|
This issue has been fixed in the new LINQ provider (known as LINQ3) which will be included in the upcoming 2.14 release. Configure your MongoClientSettings to use LinqProvider.V3 if you want to use this functionality. To configure a client to use the LINQ3 provider use code like the following
| ||||
| Comment by Githook User [ 02/Nov/21 ] | ||||
|
Author: {'name': 'rstam', 'email': 'robert@robertstam.org', 'username': 'rstam'}Message: | ||||
| Comment by Craig Wilson [ 24/Nov/15 ] | ||||
|
I'm sorry. I was apparently unclear. We need to do this inside the driver. There is not a way for you to do this right now. Craig | ||||
| Comment by Carlos Casanova [ 23/Nov/15 ] | ||||
|
That's good to know, but I couldn't find a way to use $$ROOT from LINQ. Is there any place in the documentation that explains this? | ||||
| Comment by Craig Wilson [ 23/Nov/15 ] | ||||
|
This is currently expected behavior. MongoDB sort of supports this behavior using the special $$ROOT global variable. Also If you continue on in the LINQ query and create some aggregates, it will work with those. I'll leave this ticket open as an improvement to support this using $$ROOT. |