mongod库层面:
use admin
switched to db admin
db.runCommand({ getParameter : 1, "internalQueryExecMaxBlockingSortBytes" : 1 } )
{ "internalQueryExecMaxBlockingSortBytes" : 33554432, "ok" : 1 }
MongoDB Server对于Sort排序能够支持的最大内存限制修改
use admin
switched to db admin
db.adminCommand({setParameter: 1, internalQueryExecMaxBlockingSortBytes: 104857600}) #修改为100M
也可持久到配置文件中
setParameter:
internalQueryExecMaxBlockingSortBytes:104857600
代码层面:
Aggregation aggregation=Aggregation.newAggregation(project,match,fristGroup).withOptions(AggregationOptions().allowDiskUse(true).build)