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

1.4.1 Breaking change SetDocumentId is not quite documented (or good at all)

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.4.2
    • Affects Version/s: 1.4.1
    • Component/s: None
    • Labels:
      None

      Thank you for the new version.

      Release notes:
      > There are no breaking changes in this release.

      There is a breaking change. It is mentioned in "Change Log v1.4.1-Bson.txt":
      BsonDocument.cs
      changed SetDocumentId to assume Id is already of type BsonValue

      Thus, when I call it with `int`, as I used to, then I get the exception:
      Unable to cast object of type 'System.Int32' to type 'MongoDB.Bson.BsonValue'.

      The method `SetDocumentId(object id)` is confusing now. It accepts `object id` but internally does:
      var idBsonValue = (BsonValue)id;

      This is unsafe and even not documented in code comments. Either this method should accept `BsonValue` or it should handle any suitable objects, as it did before.

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

              Created:
              Updated:
              Resolved: