mongos> BinData()
|
BinData(0,"undefined")
|
mongos> eval("BinData()")
|
BinData(0,"undefined")
|
mongos> db.eval("BinData()")
|
Wed Mar 6 15:49:33.060 JavaScript execution failed: {
|
"errmsg" : "exception: cannot convert native function to BSON",
|
"code" : 16716,
|
"ok" : 0
|
} at src/mongo/shell/db.js:L567
|
mongos>
|
However, this works:
mongos> db.eval("var b = BinData(); return;")
|
null
|
Seems like the same issue with mapReduce, but only when emitted in the map function and called with no arguments.
mongos> m = function () { emit("test",BinData()) }
|
function () { emit("test",BinData()) }
|
mongos> r = function (k, v) { return { "test" : 1 } }
|
function (k, v) { return { "test" : 1 } }
|
mongos> db.mrtest.mapReduce(m,r,{out:"mrtest_out"})
|
Thu Mar 7 13:01:57.435 JavaScript execution failed: map reduce failed:{
|
"errmsg" : "exception: JavaScript execution failed: Error: cannot convert native function to BSON near 'tion () { emit(\"test\"' ",
|
"code" : 16722,
|
"ok" : 0
|
} at src/mongo/shell/collection.js:L970
|
mongos>
|
|