module MongoModel::MapReduce::ClassMethods
Public Instance Methods
cached()
click to toggle source
# File lib/mongomodel/concerns/map_reduce.rb, line 15 def cached from(collection_name) end
collection()
click to toggle source
# File lib/mongomodel/concerns/map_reduce.rb, line 23 def collection parent_collection.map_reduce(map_function, reduce_function, map_reduce_options) end
collection_name()
click to toggle source
# File lib/mongomodel/concerns/map_reduce.rb, line 27 def collection_name @_collection_name || default_collection_name end
collection_name=(name)
click to toggle source
# File lib/mongomodel/concerns/map_reduce.rb, line 31 def collection_name=(name) @_collection_name = name end
database()
click to toggle source
# File lib/mongomodel/concerns/map_reduce.rb, line 19 def database parent_collection.db end
default_collection_name()
click to toggle source
# File lib/mongomodel/concerns/map_reduce.rb, line 35 def default_collection_name [parent_collection.name, name.demodulize.tableize.gsub(/\//, '.')].join("._") end
from_mongo(attrs)
click to toggle source
# File lib/mongomodel/concerns/map_reduce.rb, line 11 def from_mongo(attrs) new(attrs['_id'], attrs['value']) end
map_function()
click to toggle source
# File lib/mongomodel/concerns/map_reduce.rb, line 39 def map_function raise NotImplementedError, "map_function is not implemented" end
map_reduce_options()
click to toggle source
# File lib/mongomodel/concerns/map_reduce.rb, line 47 def map_reduce_options { :out => collection_name } end
reduce_function()
click to toggle source
# File lib/mongomodel/concerns/map_reduce.rb, line 43 def reduce_function raise NotImplementedError, "reduce_function is not implemented" end