Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-1755

LINQ support with Custom Serializer

    • Type: Icon: New Feature New Feature
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.2.4
    • Component/s: Linq, Serialization
    • Labels:
      None
    • Environment:
      Windows 7 Enterprise SP1

      I have a pair of classes like:

      class Parent{
       string Id {get;set;}
       Children children {get;set;}
      }
      
      class Children{
       string Id {get;set;}
      }
      

      An example of these classes serialized would be:

      // Parent
      {
       "_id":ObjectId("1"),
       "children":ObjectId("2")
      }
      
      // Children
      {
       "_id":ObjectId("2")
      }
      

      I would like to be able to filter a collection of the class Parent by using the Children Id property like this:

      GetCollection<Parent>("Parent").AsQueryable().Where(x => x.Children.Id == "2")
      

      is this possible? If not, is there a workaround to this?

            Assignee:
            james.kovacs@mongodb.com James Kovacs
            Reporter:
            rekeyea Emiliano Conti
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: