-
Type: Bug
-
Resolution: Done
-
Priority: Critical - P2
-
Affects Version/s: 1.5
-
Component/s: None
-
None
-
Environment:All
The new typed query builder in 1.5 does not correctly convert queries when dealing with signed <-> unsigned conversions and GTE, LTE, GT, LT operations. Consider:
class Foo
{
[BsonElement("bar")]
[BsonRepresentation(BsonType.Int32, AllowOverflow = true)]
public uint Bar
}
Query<Foo>.GTE(f => f.Bar, (uint)int.MaxValue + 1) // Error, needs to execute $lt : 0, but instead executes $gte : -2147483648, which is always true
Marked this critical because while folks can work around this, it is counter intuitive and assuming the bug is fixed properly, will cause breaking changes that silently lead to corruption or undefined state for anyone that starts using these APIs like this.