MongoDB取数据出错

调用Mongodb 全量获取数据的时候抛出这个错误: limit 设置成Int的最大值

List<BsonDocument> listDocs = collection.Find(filter).Project(field).Sort(sort).Limit(limit).ToList();

Command find failed: 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..

解决方案:对于sort的列需要增加索引 这样取数据时候就不会出错

 

posted @ 2019-03-27 17:11  小布雷  阅读(553)  评论(0)    收藏  举报