I am trying to use map_reduce on a collection, via the ruby console , but I am getting “NoMethodError: undefined method `map_reduce’ for #
results = Thing.collection.map_reduce(map, reduce, out: "vr")
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Map Reduce in Mongoid 3 works slightly differently. The syntax you have would work for the mongo ruby driver. In Mongoid 3, you call this off the class or criteria, like the following:
From a criteria:
From a class:
You can find more information on this in the Mongoid docs