-
Type: Bug
-
Resolution: Won't Fix
-
Priority: Minor - P4
-
None
-
Affects Version/s: 2.1
-
Component/s: BSON, Documentation, Serialization
-
Environment:Windows 10, Visual Studio 2015
-
Minor Change
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") );