Last active
April 8, 2018 02:02
-
-
Save nicolasembleton/10c0def71d0a25fb213d to your computer and use it in GitHub Desktop.
Revisions
-
nicolasembleton renamed this gist
Nov 20, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
nicolasembleton created this gist
Nov 20, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ m = function () { emit(this.ID, 1); } r = function (k, vals) { return Array.sum(vals); } db.Vehicle.mapReduce(m, r, {out: {inline: 1}, query: {value: {$gt: 1}}}) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ m = function () { if(this.Model === 1) { // business logic specific, to remove if not need (allows to filter un-wanted values / keys) for(var i in this.embed) { key = i; // the key to look dupes for value = 1; // cnt emit(key, value); } } } r = function (key, values) { return Array.sum(values); } db.MediaPlan.mapReduce(m, r, {out: {inline: 1}})