Custom Gt/Gte/Lt/Lte filter builders for unsigned integer fields represented using signed integers

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Critical - P2
    • 2.4
    • Affects Version/s: 1.5
    • Component/s: None
    • None
    • Environment:
      All
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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

      { get; set; }

      }

      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.

              Assignee:
              Robert Stam
              Reporter:
              Alexander Nagy
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: