Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-2608

Mongoid Should Honor End-Exclusive Ranges

    • Type: Icon: Task Task
    • Resolution: Done
    • 3.0.15
    • Affects Version/s: None
    • Component/s: None
    • None

      Ranges can be either end-inclusive or end-exclusive.

      An end-inclusive range, with 2 periods, looks like:

      (3 .. 7).to_a
      #=> [3, 4, 5, 6, 7]

      An end-exclusive range, with 3 periods, looks like:

      (3 ... 7).to_a
      #=> [3, 4, 5, 6]

      Mongoid handles end-inclusive ranges correctly, with:

      {"$gte" => 3, "$lte" => 7}

      But it should also handle end-exclusive ranges correctly, with:

      {"$gte" => 3, "$lt" => 7}

      Mongoid currently ignores whether a range is end-exclusive, and always generates queries as though the range were end-inclusive.

      This is tested as of v2.5.1.

            Assignee:
            Unassigned Unassigned
            Reporter:
            yfeldblum yfeldblum
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: