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

#max and #min returns "start" when field is nil

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 2.3.4
    • Component/s: None
    • Labels:

      Description

       
      class Foo
        include Mongoid::Document
        field :position, type: Integer
      end
       
      Foo.create!
      Foo.max(:position)   # => "start"
      Foo.min(:position)   # => "start"
      Foo.max(:whatever)   # => "start"
      

      Shouldn't #max and #min return nil or 0 instead?

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: