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

Save fails with duplicate key exception when updating an existing document and _id is a string internally represented as an ObjectId in the database

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.1
    • Affects Version/s: None
    • Component/s: None
    • None

      To reproduce use this class:

      public class C

      { [BsonRepresentation(BsonType.ObjectId)] public string Id; public int X; }

      and these statements:

      var doc = new C

      { X = 1 }

      ;
      collection.Save(doc);

      doc.X = 2;
      collection.Save(doc);

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            robert@mongodb.com Robert Stam
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: