XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Works as Designed
    • Affects Version/s: 2.10.4
    • Fix Version/s: None
    • Component/s: Bson, Serialization
    • Labels:
      None
    • Environment:
      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

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

              Dates

              Created:
              Updated:
              Resolved: