gpt4 book ai didi

MongoDB 允许磁盘使用不工作..

转载 作者:IT老高 更新时间:2023-10-28 13:14:40 37 4
gpt4 key购买 nike

专家。

我是 MongoDB 的新手,但我知道的足够让我自己陷入困境。例如:

db.test.aggregate(
[
{$group: {_id: {email: "$email", gender: "$gender"}, cnt: {$sum: 1}}},
{$group: {_id: "$_id.email", cnt: {$sum: 1}}},
{$match: {cnt: 2}}
],
{allowDiskUse : true}
)

无论我尝试什么变体,我都会收到相同的错误(“Pass allowDiskUse:true to opt in”):

Error("Printing Stack Trace")@:0 ()@src/mongo/shell/utils.js:37 ([object Array],[object Object])@src/mongo/shell/collection.js:866 @(shell):7

uncaught exception: aggregate failed: { "errmsg" : "exception: Received error in response from mongo1.mscnet.com:27017: { $err: \"Exceeded memory limit for $group, but didn't allow external sort. Pass allowDiskUse:true to opt in.\", code: 16945 }", "code" : 16945, "ok" : 0 }

仅供引用:我使用的是 Mongo 2.6

最佳答案

请在运行命令中使用聚合查询,它将允许使用allowDiskUse标签。

db.runCommand(
{ aggregate: "test",
pipeline: [
{$group: {_id: {email: "$email", gender: "$gender"}, cnt: {$sum: 1}}},
{$group: {_id: "$_id.email", cnt: {$sum: 1}}},
{$match: {cnt: 2}}
],
allowDiskUse: true
}
)

关于MongoDB 允许磁盘使用不工作..,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27491245/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com