I have a set of documents in Mongo. Say:
[
{ summary:\"This is good\" },
{ summary:\"This is bad\" },
{ summary:\"Something that is neither good
A basic MapReduce example
var m = function() {
var words = this.summary.split(" ");
if (words) {
for(var i=0; i
This will insert word counts into a collection name words_count which you can sort (and index)
Note that it doesn't use stemming, omit punctuation, handles stop words etc.
Also note you can optimize the map function by accumulating repeating word(s) occurrences and emitting the count, not just 1