【问题标题】:MongoDB and Robo 3T - Error "Can't output mapReduce results to internal DB admin" / "Location31321"MongoDB 和 Robo 3T - 错误“无法将 mapReduce 结果输出到内部数据库管理员”/“Location31321”
【发布时间】:2021-07-02 13:27:10
【问题描述】:

我目前正在学习如何处理 MongoDB。

很遗憾,我无法执行 mapReduce 函数,而且我绝对没有找到任何有关该错误的信息:

Error Message

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以外的任何数据库。
  • 现在成功了!我只需要创建一个新数据库...非常感谢!

标签: mongodb mapreduce robo3t


【解决方案1】:

我有同样的错误。我没有做“使用管理员”,而是切换到另一个名称的数据库,它对我有用。

使用“使用管理员”:

> db.Eleves.mapReduce(map, reduce, {out : "total_masculin"});
Error: map reduce failed:{
        "ok" : 0,
        "errmsg" : "Can't output mapReduce results to internal DB admin",
        "code" : 31321,
        "codeName" : "Location31321"
} :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DBCollection.prototype.mapReduce@src/mongo/shell/collection.js:1093:15
@(shell):1:1

切换数据库:

> use labo1
switched to db labo1

在此数据库中重新创建我的收藏后:

> db.Eleves.mapReduce(map, reduce, {out : "total_masculin"});
{ "result" : "total_masculin", "ok" : 1 }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-01-09
    • 2018-02-19
    • 2020-10-29
    • 1970-01-01
    • 2019-08-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多