The piece of code runs fine on mongod, but running on mongos would raise the exception:
error
{ "$err" : "unrecognized command: mapReduce", "code" : 13390 }changing the command to use small caps mapreduce runs fine on both mongod and mongos.
db.bar.insert({ x: 1 }); var map = function() { emit( this.x, 1 ); }; var reduce = function( key, values ) { return 1; }; var mrResult = db.runCommand({ mapReduce: 'bar', map: map, reduce: reduce, out: { inline: 1 }});
Similarly, the following works on mongod but not mongos:
db.runCommand({eval: function () { print("noop"); } });
- is duplicated by
-
SERVER-11217 The mapReduce command should accept new name "mapReduce" on mongos
- Closed
-
SERVER-11003 discrepancy on mapReduce and mapreduce command
- Closed