-
Type:
Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
if the map-reduce output was a large temp collection, each method raise 'cursor not found'.
inspect mongoid source file(https://github.com/mongoid/mongoid/blob/master/lib/mongoid/contextual/map_reduce.rb#L270) but it can't have a no_timeout option.
suggest like this style
mapreduce.no_timeout.each do |doc|
end
this is similar normal query no_timeout. like this
Mode.all.no_timeout.each do |model|
end
my ruby skill is poor so i can't implement suggest style and pull request.
below source code is what i used my project
module Mongoid
module Contextual
class MapReduce
def each_with_no_timeout
if block_given?
documents_with_no_timeout.each do |doc|
yield doc
end
else
to_enum
end
end
private
def documents_with_no_timeout
return results["results"] if results.has_key?("results")
session[output_collection].find.no_timeout
end
end
end
end