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

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 2.3
    • 2.2.4
    • Linq, Serialization
    • None
    • Windows 7 64bits
    • Fully Compatible

    Description

      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.

      Attachments

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

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: