mongo 的 find和aggregate

来源:互联网 发布:淘宝代购申诉 编辑:程序博客网 时间:2024/06/05 09:18
db.d.find({},{'Detail':0}).sort({'RecordCreateTime':-1}).skip(400).limit(20)

报异常:
“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.”

解决:
1、改用aggregate ,并将allowDiskUse=true ,为false有RAM 100M限制,

db.d.aggregate([            { $match:{}},            { $project:{'Word':1} },            {'$sort':{'RecordCreateTime':-1}},            {'$skip':1000},            {'$limit':30}        ],{allowDiskUse:true})

2、当然不加排序sort 也可以解决

0 0
原创粉丝点击