doramart / DoraCMS

DoraCMS是基于Nodejs+eggjs+mongodb编写的一套内容管理系统,结构简单,较目前一些开源的cms,doracms易于拓展,特别适合前端开发工程师做二次开发。
https://www.html-js.cn
MIT License
3.46k stars 1.02k forks source link

分页问题 #54

Closed peasonlee closed 4 years ago

peasonlee commented 7 years ago

分页查询数据的方法有点问题,由于每个分页是根据条件查询出全部的数据,再用数组进行切割来获取分页数据,如果表中的数据够多的话,会出现超过mongodb单次查询上限的异常。 该异常应该是由于sort只允许最大32MB的内存占用,如果条件查询出的数据超过了32MB则mongodb会抛出异常; 异常信息: "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."

doramart commented 7 years ago

好像还没遇到这个问题,后面研究下,谢谢

peasonlee commented 7 years ago

这个问题最简单的解决方法就是将排序的字段建立索引。

doramart commented 4 years ago

请升级到 DoraCMS 最新版本