mongodb sort: Executor error during find command: OperationFailed: Sort operation used more than

mongodb 排序出现内存溢出:
 
Error: error: {
"ok" : 0,
"errmsg" : "Executor error during find command: OperationFailed: Sort operation used more than the maximum 33554432 bytes of RAM. Add an index, or specify a smaller limit.",
"code" : 96,
"codeName" : "OperationFailed"
}

使用limit函数限制其输出就可以了:
 
db.getCollection('老布').find({}).sort({'created_at':-1}).limit(1000)

0 个评论

要回复文章请先登录注册