always use hard limit for explain()

This commit is contained in:
Mike Dirolf 2009-09-16 10:39:52 -04:00
parent 65a8d3f2c1
commit b6901673bb
1 changed files with 4 additions and 2 deletions

View File

@ -106,14 +106,16 @@ module Mongo
# Returns an explain plan record for this cursor.
def explain
old_val = @query.explain
limit = @query.number_to_return
@query.explain = true
@query.number_to_return = -limit.abs
c = Cursor.new(@db, @collection, @query)
explanation = c.next_object
c.close
@query.explain = old_val
@query.explain = false
@query.number_to_return = limit
explanation
end