Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-527

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

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical - P2 Critical - P2
    • 2.4
    • 1.5
    • None
    • None
    • All

    Description

      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.

      Attachments

        Activity

          People

            robert@mongodb.com Robert Stam
            optimiz3 Alexander Nagy
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: