MongoDB 未添加索引 当数据量较大时 分页查询报错问题解决

异常信息:MongoDB.Driver.MongoCommandException: Command find failed: Executor error during find command :: caused by :: Sort operation used more than the maximum 33554432 bytes of RAM. Add an index, or specify a smaller limit..

解决办法:对条件字段 加索引

 

db.你的collection.createIndex({"你的字段": -1}),此处 -1 代表倒序,1 代表正序; 
db.你的collecton.getIndexes(); 

posted @ 2020-11-28 15:29  谷樵  阅读(640)  评论(0编辑  收藏  举报