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

Make IMongoCollection covariant

    • Type: Icon: Improvement Improvement
    • Resolution: Works as Designed
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.5
    • Component/s: BSON
    • Labels:
      None
    • Fully Compatible

      For my app, I'd like to define the following property on my data context class:

      public IMongoCollection<BsonDocument> C => data.GetCollection<RawBsonDocument>( "c" );

      My purpose is to have a single IMongoCollection instance from which I can retrieve raw documents, but into which I can also insert non-raw ones.

      This improvement involves adding `out` to IMongoCollection's definition:

      public interface IMongoCollection<out TDocument>

            Assignee:
            vincent.kam@mongodb.com Vincent Kam (Inactive)
            Reporter:
            happynomad121@gmail.com Adrian Pinter
            Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: