[CSHARP-4265] Can't project only certain properties of an array using Fluent Find Created: 21/Jul/22 Updated: 25/Jul/22 |
|
| Status: | Backlog |
| Project: | C# Driver |
| Component/s: | Builders |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Flavio Cimolin | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
Cluster: Standalone Edition: MongoDB 5.0.9 Community SummaryUsing the C# driver and How to reproduceLet's say I have this data in my database:
Using
The generated request for this ends up being:
...which selects all of "Players" properties. Directly inputting the json works, but is not the desired way:
Additional BackgroundThis spawned a question here. |
| Comments |
| Comment by James Kovacs [ 25/Jul/22 ] | ||||||||||||||||
|
Hi, fhcimolin@gmail.com, We have investigated this issue further and realize that the problem is in how Fluent Find performs projections. We recommend using LINQ (via AsQueryable) (with LINQ2 or LINQ3) or Aggregate (with LINQ3) as noted by dmitry.lukyanov@mongodb.com in his previous response. Given that there are two available workarounds, we do not plan to prioritize this issue in the near term. If this will cause an issue, please comment on this ticket and we will reconsider. Sincerely, | ||||||||||||||||
| Comment by Dmitry Lukyanov (Inactive) [ 21/Jul/22 ] | ||||||||||||||||
|
Hey fhcimolin@gmail.com, thanks for your report, we will look at this and come back to you.
| ||||||||||||||||
| Comment by James Kovacs [ 21/Jul/22 ] | ||||||||||||||||
|
Self-contained repro:
Both LINQ2 and LINQ3 generate the following incorrect MQL:
|