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

Selecting from a IMongoQueryable collection with a Linq Expression throws an error because of 'Id' property

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.3
    • Affects Version/s: 2.2.4
    • Component/s: Linq, Serialization
    • Labels:
      None
    • Environment:
      Windows 7 64bits
    • Fully Compatible

      Using the mongoDb c# driver 2.2.4, selecting from a IMongoQueryable collection with a Linq Expression throws an error because of my Id field.

      The exception thrown is 'Element 'Id' does not match any field or property of class MongoDbHierarchicalStoring.Man.'

      You can find more info on the stackoverflow post: http://stackoverflow.com/questions/38508622/selecting-from-a-imongoqueryable-collection-with-a-linq-expression-throws-an-err

      If I change my 'Id' property and rename it '_id', it worked. But in a prior version of the driver (2.1.1) it used to work fine.
      The sample you can find in the attached file proves it : testing with the old version of the driver retrieves the data where as the new version throws an exception.

        1. bug.cs
          2 kB
        2. CSHARP-1719-Regression.zip
          1 kB

            Assignee:
            Unassigned Unassigned
            Reporter:
            Flo Florent BROUCA
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: