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 也可以解决