ruby on rails - mongoid .limit does not work in mongoid 3.1.x -
i tried in rails mongoid 3.1.0 , lastest 3.1.3. .limit not work. below should return 1 row returns (4)
code:
@go = gallery.limit(1) logger.info "count: #{@go.count}"
output:
count: 4 moped: 54.234.11.193:10055 query database=mongohqtestdatabase collection=galleries selector= {"$query"=>{}, "$orderby"=>{:_id=>1}} flags=[:slave_ok] limit=-1 skip=0 batch_size=nil fields=nil (276.2010
ms)
which version of mongoid limit() ?
the limit
command works fine, reason count
ignores limit. if cast array you'll see limit working.
array(gallery.limit(1)).length # gives 1
also, if iterate through objects you'll see limit working.
Comments
Post a Comment