【发布时间】:2021-01-12 13:53:37
【问题描述】:
我在 MongoTemplate 中使用了 allowDiskUse 选项:
AggregateIterable<Document> results = mongoTemplate.getCollection("match")
.aggregate(...).allowDiskUse(true)
仍然出现此错误:
超过 $group 的内存限制,但不允许外部排序。传递 allowDiskUse:true 以选择加入。
有问题吗?
请注意,我使用的是 mongo java 客户端 3.11 和 mongo atlas M2 (v 4.2.9)
我也尝试过使用 batchSize 和 useCursor,但没用
【问题讨论】:
-
验证它是否适用于 mongo shell 和最新的驱动程序版本。
-
我在 mongoshell 中遇到了同样的错误。我尝试使用 db.runCommand(...) 和 db.getCollection("...").aggregate(...) 命令
-
从问题中描述正确用法(用于 mongo shell)的参考文档,并确保您按照文档发出命令。
标签: java mongodb mongotemplate