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

Add ToArray and ToList methods to BsonArray

    XMLWordPrintableJSON

Details

    • Icon: New Feature New Feature
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • 1.1
    • 1.0
    • Feature Request
    • None

    Description

      It would be nice if BsonArray had ToArray and ToList methods so we could write code like:

      var document = new BsonDocument("array", new BsonArray

      { 1, 2, 3 }

      );
      var list = document["array"].AsBsonArray.ToList<int>();

      instead of:

      var list = document["array"].AsBsonArray.Select(v => v.AsInt32).ToList();

      or something similar if there's a better alternative.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: