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

Collection Aggregation Merge Default Value Throws an Exception

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 2.12.0
    • Affects Version/s: 2.10.2
    • Component/s: BSON
    • None
    • Environment:
      Windows 10, Microsoft .Net Framework 4.7.2

      This line tries to convert what could be a BsonString type parameter into a BsonDocument and fails. The default (by documentation) acceptable input for a $merge aggregation pipeline operation is the collection name only (a string), but could be a complex object with properties like: into.

      Workaround: I could put the, "into" property and make a BsonDocument as a $merge operation's value, but I only knew to do this by reading the source code after receiving an error that the BsonString could not be converted to a BsonDocument.

      https://github.com/mongodb/mongo-csharp-driver/blob/9d0f35043498af39041e77df2655ef1aad3b030e/src/MongoDB.Driver/MongoCollectionImpl.cs#L809

            Assignee:
            mikalai.mazurenka@mongodb.com Mikalai Mazurenka (Inactive)
            Reporter:
            clombardi@confluence.com Christopher Lombardi
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: