LINQ3 produces ExpressionNotSupported error on ContainsKey for DictionaryRepresentation.ArrayOfDocuments

XMLWordPrintableJSON

    • Type: New Feature
    • Resolution: Duplicate
    • Priority: Unknown
    • None
    • Affects Version/s: 2.20.0
    • Component/s: LINQ3
    • None
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      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 

       

              Assignee:
              Robert Stam
              Reporter:
              John Gonyo
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: