Tuesday, 8 December 2015

{"name":"MongoError","errmsg":"exception: Sort exceeded memory limit of 104857600 bytes, but did not opt in to external sorting. Aborting operation. Pass allowDiskUse:true to opt in.","code":16819,"ok":0}

{"name":"MongoError","errmsg":"exception: Sort exceeded memory limit of 104857600 bytes, but did not opt in to external sorting. Aborting operation. Pass allowDiskUse:true to opt in.","code":16819,"ok":0}

if you have this issue , you just need:

db.bigdata.aggregate(
[
 {$group : {_id : "$range", total : { $sum : 1 }}},
 {$sort : {total : -1}}
],
 {allowDiskUse: true}
);

But if you use mongoose, you should:

var aggregation = MyModel.aggregate(...); 
aggregation.options = { allowDiskUse: true }; 
aggregation.exec(function() {});


http://www.mkyong.com/mongodb/mongodb-sort-exceeded-memory-limit-of-104857600-bytes/
http://stackoverflow.com/questions/23894077/is-there-any-way-to-supply-the-allowdiskuse-option-to-an-mongoose-js-aggregation



No comments:

Post a comment