[CSHARP-2786] Investigate correctness of generated mongo queries with `Project` linq Created: 08/Oct/19  Updated: 28/Oct/23  Resolved: 15/Nov/22

Status: Closed
Project: C# Driver
Component/s: Linq
Affects Version/s: None
Fix Version/s: 2.18.0

Type: Task Priority: Minor - P4
Reporter: Dmitry Lukyanov (Inactive) Assignee: Robert Stam
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to CSHARP-2705 [Regression] Linq Translation of Nest... Closed

 Description   

See the PR comment: https://github.com/DmitryLukyanov/mongo-csharp-driver/pull/61/files#r329543714

Small summary: In the mentioned tests, there are the same generated mongo queries for little different Linq expressions.

Also, it will not be superfluous to add asserting on generated mongo queries for the rest tests in the `PredicateTranslatorValidationTests.cs`



 Comments   
Comment by Robert Stam [ 15/Nov/22 ]

This issue has been fixed in the new LINQ provider (known as LINQ3), which was introduced in the 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

var connectionString = "mongodb://localhost";
var clientSettings = MongoClientSettings.FromConnectionString(connectionString);
clientSettings.LinqProvider = LinqProvider.V3;
var client = new MongoClient(clientSettings);

Generated at Wed Feb 07 21:43:32 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.