首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

mongdb "errmsg" : "exception: 'out' has to be a string or an obje

2013-07-16 
mongdb errmsg : exception: out has to be a string or an object解决errmsg : exception: out

mongdb "errmsg" : "exception: 'out' has to be a string or an object"

解决"errmsg" : "exception: 'out' has to be a string or an object"

map=function (){ for(var key in this){ emit(key, {count:1}); }}

reduce=function (key, emits){ total=0; for(var i in emits){ total+=emits[i].count; } return{"count":total}; }

?

> r=db.runCommand({"mapreduce":"users", "map":map,"reduce":reduce})

{

"errmsg" : "exception: 'out' has to be a string or an object",

"code" : 13606,

"ok" : 0

?

}

在mongodb-src-r2.4.5版本中需要指定out才能正常查询数据

> r=db.runCommand({"mapreduce":"users", "map":map,"reduce":reduce,"out":"sss"})

{

"result" : "sss",

"timeMillis" : 6,

"counts" : {

"input" : 3,

"emit" : 12,

"reduce" : 4,

"output" : 4

},

"ok" : 1

}

?

热点排行