XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Works as Designed
    • Icon: Major - P3 Major - P3
    • None
    • 2.10.4
    • BSON, Serialization
    • None
    • All environments

    Description

      Hello. When the regex is value of property in root document there is no problem. The problem seems to be just for nested properties

      Here is a unit test.

              public static IEnumerable<object[]> TestData()
              {
                  yield return new object[]
                  {
                      new BsonDocument
                      {
                          new BsonElement("field", new BsonRegularExpression("pattern"))
                      }
                  };
                  yield return new object[]
                  {
                      new BsonDocument
                      {
                          new BsonElement("field", new BsonDocument
                          {
                              new BsonElement("$regex", new BsonRegularExpression("pattern"))
                          })
                      }
                  };
              }
       
              [Theory]
              [MemberData(nameof(TestData))]
              public void Test(BsonDocument document)
              {
                  var json = document.ToJson();
                  BsonSerializer.Deserialize<BsonDocument>(json);
              }
      

      Attachments

        Activity

          People

            mikalai.mazurenka@mongodb.com Mikalai Mazurenka (Inactive)
            muhaha45@gmail.com Tomáš Chroboček
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: