我試圖使用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
}