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

Add a constructor to allow powershell to cast MongoCollection to MongoCollection<T>

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Minor - P4 Minor - P4
    • None
    • 1.6
    • None
    • None
    • PowerShell 3.0

    Description

      This will allow the following PowerShell script to work. Powershell does not handle generic methods of classes lacking a a generic signature, or having a different generic signature than the method.

      Add-Type -Path 'MongoDB.Bson.dll'
      Add-Type -Path 'MongoDB.Driver.dll'
      $cn = [MongoDB.Driver.MongoServer]::Create("mongodb://localhost/MyDb");
      $db = $cn['EventLog'];
      [MongoDB.Driver.MongoCollection[System.Diagnostics.EventLogEntry]]$events = $db['Events.Simple'];

      Attachments

        Activity

          People

            Unassigned Unassigned
            zippy1981 Justin Dearing
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: