I am using Ruby code to calculate sum from the array returned by Mongoid.
But maybe using Map/Reduce can be faster, except I don't see any docs for Map Reduce on mongoid.org and Google for
map reduce site:mongoid.org
doesn't give any result either. (or using MapReduce
or Map/Reduce
)
There are docs on MongoDB's site
map reduce site:mongodb.org
but need to use Map Reduce with Mongoid as well.