Details
-
Bug
-
Resolution: Works as Designed
-
Major - P3
-
None
-
2.10.4
-
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);
|
}
|