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.
|
# Returns an explain plan record for this cursor.
|
||||||
def explain
|
def explain
|
||||||
old_val = @query.explain
|
limit = @query.number_to_return
|
||||||
@query.explain = true
|
@query.explain = true
|
||||||
|
@query.number_to_return = -limit.abs
|
||||||
|
|
||||||
c = Cursor.new(@db, @collection, @query)
|
c = Cursor.new(@db, @collection, @query)
|
||||||
explanation = c.next_object
|
explanation = c.next_object
|
||||||
c.close
|
c.close
|
||||||
|
|
||||||
@query.explain = old_val
|
@query.explain = false
|
||||||
|
@query.number_to_return = limit
|
||||||
explanation
|
explanation
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue