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

Add BsonDocument.Parse(string json, bool allowDuplicateElementNames)

    • Type: Icon: New Feature New Feature
    • Resolution: Won't Fix
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: BSON
    • None
    • Dotnet Drivers
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      By default, BsonDocument does not allow duplicate element names, but it can be enabled through the constructor. Unfortunately this functionality is not exposed in our BsonDocument.Parse and BsonDocument.TryParse methods. When creating Atlas Search queries, it is common to have multiple "must", "mustNot", and "should" elements in a compound query. For example:

      {
        index: "ShipmentProjections",
        compound: {
          must: {
            equals: {
              value: 208414,
              path: "MerchantId",
            },
          },
          must: {
            in: {
              path: "ShipmentId",
              value: [100405234]
            }
          }
        },
      }
      

      We should add support for BsonDocument.Parse(string json, bool allowDuplicateElementNames) and BsonDocument.TryParse(string json, bool allowDuplicateElementNames, out BsonDocument result) to our API.

      Created based on this community forums post.

            Assignee:
            boris.dogadov@mongodb.com Boris Dogadov
            Reporter:
            james.kovacs@mongodb.com James Kovacs
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: