Summary
LINQ3 queries using ContainsKey on a Dictionary that is stored as DictionaryRepresentation.ArrayOfDocuments throws a ExpressionNotSupported exception. ContainsKey support was added to dictionaries stored as DictionaryRepresentation.Document in CSHARP-4557 and this commit Support needed for the ArrayOfDocuments representation as well.
How to Reproduce
public class Model { [BsonDictionaryOptions(DictionaryRepresentation.ArrayOfDocuments)] public virtual Dictionary<string, string> Foo { get; set; } } collection.AsQueryable() .Where(x => x.Foo.ContainsKey("x")).ToList();
Additional Background
The LINQ2 code for this I found here
- duplicates
-
CSHARP-4443 Support LINQ3 queries against all 3 possible representations of Dictionaries
- Backlog