Files
mongo/jstests/core/mr_comments.js
Siyuan Zhou 3660343e0b SERVER-12127 migrate js tests to jscore suite when not related to writes
Migrate js tests starting from j-z.
Include SERVER-12920 Update use_power_of_2.js

Signed-off-by: Matt Kangas <matt.kangas@mongodb.com>
2014-03-03 22:54:10 -05:00

29 lines
701 B
JavaScript

t = db.mr_comments
t.drop()
t.insert( { foo : 1 } )
t.insert( { foo : 1 } )
t.insert( { foo : 2 } )
res = db.runCommand(
{ mapreduce : "mr_comments",
map : "// This will fail\n\n // Emit some stuff\n emit(this.foo, 1)\n",
reduce : function(key, values){
return Array.sum(values);
},
out: "mr_comments_out"
});
assert.eq( 3 , res.counts.emit )
res = db.runCommand(
{ mapreduce : "mr_comments",
map : "// This will fail\nfunction(){\n // Emit some stuff\n emit(this.foo, 1)\n}\n",
reduce : function(key, values){
return Array.sum(values);
},
out: "mr_comments_out"
});
assert.eq( 3 , res.counts.emit )