-
Type: New Feature
-
Resolution: Won't Fix
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: BSON
-
None
-
Dotnet Drivers
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.