我试图使用MongoDB的客户端“Robomongo” http://robomongo.org/Robomongo,如何使用自定义函数?
它工作正常,但我不明白如何访问到“功能”一节中创建的功能...
我要测试的MapReduce的功能,所以我创建了一个map()和减少()函数,但是当我在写我的外壳:
db.<name_of_collection>.mapReduce(map, reduce, {out: {inline: 1}});
Robomongo给我下面的错误:
ReferenceError: map is not defined (shell):1
我也试过这样:
db.<collection_name>.mapReduce(db.system.js.map, db.system.js.reduce, {out: {inline: 1}});
但同样,有些事情似乎是错误的...
uncaught exception: map reduce failed:{
"errmsg" : "exception: JavaScript execution failed: ReferenceError: learn is not defined",
"code" : 16722,
"ok" : 0
}