【发布时间】:2021-07-02 13:27:10
【问题描述】:
我目前正在学习如何处理 MongoDB。
很遗憾,我无法执行 mapReduce 函数,而且我绝对没有找到任何有关该错误的信息:
errmsg:“无法将 mapReduce 结果输出到内部数据库管理员”
代号:“Location31321”
有人知道我可以做些什么来解决这个问题吗?
这是我的代码(我的同事对此没有任何问题):
db.courses.mapReduce(
function(){emit(this.course, this.hours);},
function(key, hours) {return Array.sum(hours)},
{
query: {semester: 1},
out: "totals"
}
)
db.totals.find()
提前非常感谢!
【问题讨论】:
-
连接到
admin以外的任何数据库。 -
现在成功了!我只需要创建一个新数据库...非常感谢!