Summary
After upgrading from version 2.18.0 to 2.19.0, I encountered this error in my project:
{{MongoDB.Driver.Linq.ExpressionNotSupportedException: Expression not supported: x.Foo.ContainsKey("bar")
}}
After explicitly setting the LinqProvider back to V2, the error disappears.
Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).
Driver version: 2.19.0
Server version: 5.0.15
How to Reproduce
For a collection of documents in this format:
{{{}}
_id: ...,
Foo:
}
Create an IQueryable and perform the following LINQ query:
entities.Where(x => x.Foo.ContainsKey("bar"));
Additional Background
I'm not sure what else would be useful to add here, but I'm happy to provide further details if required.