Add TryParse() support to BsonDocument

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Trivial - P5
    • 2.4
    • Affects Version/s: 2.2.3
    • Component/s: BSON
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      It would be nice to have TryParse support for BsonDocument instead of just the Parse method which throws an exception.

      For example, the current way to parse a string:

      BsonDocument document = BsonDocument.Parse("{}");
      

      If this fails it throws an exception. However most of the .NET framework now supports a less heavy check, for example:

      BsonDocument document;
      
      if (!document.TryParse("{}",out document))
      {
          // Handle failed parse
      }
      

            Assignee:
            Robert Stam
            Reporter:
            Lloyd Kinsella
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: