[CSHARP-2134] Missing support for .All() query Created: 23/Dec/17  Updated: 27/Oct/23  Resolved: 03/Nov/22

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

Type: New Feature Priority: Major - P3
Reporter: Stas Assignee: Robert Stam
Resolution: Works as Designed Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Code example : collection.AsQueryable().All(x => x.Id != null);

Result :
System.NotSupportedException: 'The method All is not supported in the expression tree: aggregate([]).All(x => (x.Id != null)).'



 Comments   
Comment by Robert Stam [ 03/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:41:42 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.