-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
I'm seeing some strange behavior when trying to get the last record from a query limited to a number of documents. I have the example query below:
Event.where(:_id.gt => '517f2486a812fd8222002a1f').limit(1000).to_a.last._id
=> "517f248da812fd8222002eef"
Event.where(:_id.gt => '517f2486a812fd8222002a1f').limit(1000).last._id
=> "518011c9a812fd94f7000011"
irb(main):009:0> Event.where(:_id.gt => '517f2486a812fd8222002a1f').limit(1000)
=> #<Mongoid::Criteria
selector: {"_id"=>{"$gt"=>"517f2486a812fd8222002a1f"}}
options: {:limit=>1000}
class: Event
embedded: false>
Mongodb 2.4
Mongoid 3.1.2