[CSHARP-1754] Bug in LINQ support for $all clause Created: 26/Aug/16  Updated: 29/Jun/22  Resolved: 29/Jun/22

Status: Closed
Project: C# Driver
Component/s: Linq, LINQ3
Affects Version/s: 2.2.3, 2.3.0-beta1
Fix Version/s: 2.17.0

Type: Bug Priority: Major - P3
Reporter: Patryk Bajer Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: triaged
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File Program.cs    
Epic Link: CSHARP-3615
Backwards Compatibility: Fully Compatible

 Description   

The following query:

var results = queryable.Where(x => x.Occurrences.Any(o => requiredMeta.All(i => o.Meta.Contains(i)))).ToList();

is rendered incorrectly in the aggregation query sent to MongoDB. There is no "Occurrences" part in the $all clause. Please see attached Program.cs for details on how to reproduce the problem.



 Comments   
Comment by Robert Stam [ 29/Jun/22 ]

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

Comment by Githook User [ 29/Jun/22 ]

Author:

{'name': 'rstam', 'email': 'robert@robertstam.org', 'username': 'rstam'}

Message: CSHARP-1754: Verify that issue is not present in LINQ3.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/ee34ba7a691238e61c23df69f41bad034f5acc64

Comment by Patryk Bajer [ 15/Sep/16 ]

Any chance of fixing this bug in the upcoming release?

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