always use hard limit for explain()
This commit is contained in:
parent
65a8d3f2c1
commit
b6901673bb
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue