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

Query.In with BsonArray created via IEnumerable<BsonValue> constructor generated wrong

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • 1.3.1
    • None
    • None

    Description

      1) create 2 bson values:
      BsonValue convertedValue1 = BsonString.Create("str1");
      BsonValue convertedValue2 = BsonString.Create("str2");

      2) Create BsonArray: var array = new BsonArray(new[]

      {convertedValue1, convertedValue2}

      );
      3) Create query: Query.ElemMatch("Properties", Query.And(Query.EQ(propertyIdFieldName,"some Id"), Query.In("someProperty", array )));

      Generated result:
      { "Properties" : { "$elemMatch" : { "PropertyDefinitionId" : "some Id", "someProperty" :

      { "$in" : [["str1", "str1"]] }

      } } }
      Expected result:
      { "Properties" : { "$elemMatch" : { "PropertyDefinitionId" : "some Id", "someProperty" :

      { "$in" : ["str1", "str1"] }

      } } }

      Attachments

        Activity

          People

            craig.wilson@mongodb.com Craig Wilson
            gfx00 Brian
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: