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

Collection Aggregation Merge Default Value Throws an Exception

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 2.10.2
    • 2.12.0
    • BSON
    • None
    • Windows 10, Microsoft .Net Framework 4.7.2

    Description

      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

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: