Details
-
Bug
-
Resolution: Won't Fix
-
Minor - P4
-
None
-
2.1
-
Windows 10, Visual Studio 2015
-
Minor Change
Description
This is just to notify a breaking change, the regex find query has to change from .Eq to .Regex in order to work,
In Driver 2.0.1 this works:
var filter = new FilterDefinitionBuilder<MyModel>()
|
.Eq(
|
x => x.MyStringField,
|
new BsonRegularExpression("^mongo", "i")
|
);
|
In Driver 2.1.0 the above example throws a Casting exception between String and Regex,
Unable to cast object of type 'MongoDB.Bson.Serialization.Serializers.StringSerializer' to type 'MongoDB.Bson.Serialization.IBsonSerializer`1[MongoDB.Bson.BsonRegularExpression]'
so I need to change to this:
var filter = new FilterDefinitionBuilder<MyModel>()
|
.Regex(
|
x => x.MyStringField,
|
new BsonRegularExpression("^mongo", "i")
|
);
|