class MrMongo::MapReduce
Attributes
collection[RW]
finalize[RW]
js_mode[RW]
limit[RW]
map[RW]
out[RW]
query[RW]
reduce[RW]
scope[RW]
sort[RW]
verbose[RW]
Public Class Methods
new(context)
click to toggle source
# File lib/mr_mongo/map_reduce.rb, line 6 def initialize(context) @context = context end
Public Instance Methods
exec()
click to toggle source
# File lib/mr_mongo/map_reduce.rb, line 26 def exec exec_with_options(to_options) end
exec_on_memory()
click to toggle source
# File lib/mr_mongo/map_reduce.rb, line 30 def exec_on_memory options = to_options options[:out] = {inline: true} options[:raw] = true exec_with_options(options) end
insert_into_collection(*args)
click to toggle source
# File lib/mr_mongo/map_reduce.rb, line 38 def insert_into_collection(*args) mongo_collection.send(:insert, *args) end
Also aliased as: insert
to_options()
click to toggle source
# File lib/mr_mongo/map_reduce.rb, line 10 def to_options options = {} options[:query] = @query if defined?(@query) options[:sort] = @sort if defined?(@sort) options[:limit] = @limit if defined?(@limit) options[:finalize] = @finalize if defined?(@finalize) options[:out] = @out if defined?(@out) options[:verbose] = @verbose if defined?(@verbose) options[:scope] = @scope if defined?(@scope) options[:raw] = true if defined?(@out) and @out.is_a?(::Hash) and @out[:inline] options end
Private Instance Methods
exec_with_options(options)
click to toggle source
# File lib/mr_mongo/map_reduce.rb, line 44 def exec_with_options(options) mongo_collection.map_reduce(@map, @reduce, options) end
mongo_collection()
click to toggle source
# File lib/mr_mongo/map_reduce.rb, line 48 def mongo_collection @context.db.collection(@collection) end