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

Avg returning impossible values

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

      1.9.3p125 :061 > Keyword.where(:t => 3.3).avg(:t)
      => 115.46699999999579
      1.9.3p125 :062 > Keyword.where(:t.gt => 10).count
      => 0
      1.9.3p125 :063 > Keyword.where(:t.lt => 0).count
      => 0
      1.9.3p125 :064 > Keyword.where(:t => 3.3).count
      => 3499
      1.9.3p125 :065 > Keyword.where(:t => 3.3).avg(:t)
      => 115.46699999999579
      1.9.3p125 :092 > Keyword.where(:t => 7.6).avg(:t)
      => 7.599999999999999
      1.9.3p125 :093 > Keyword.where(:t => nil).count
      => 0
      1.9.3p125 :066 > Keyword.where(:t => 3.3).explain
      => {"cursor"=>"BasicCursor", "isMultiKey"=>false, "n"=>3499, "nscannedObjects"=>143773, "nscanned"=>143773, "nscannedObjectsAllPlans"=>143773, "nscannedAllPlans"=>143773, "scanAndOrder"=>false, "indexOnly"=>false, "nYields"=>0, "nChunkSkips"=>0, "millis"=>173, "indexBounds"=>{}, "allPlans"=>[{"cursor"=>"BasicCursor", "n"=>3499, "nscannedObjects"=>143773, "nscanned"=>143773, "indexBounds"=>{}}], "server"=>"..."}

      I'm using latest version of mongoid (3.0 Oct 15th, 2012) and mongodb (2.2 August 29th 2012)

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

              Created:
              Updated:
              Resolved: