"errmsg" : "distinct too big, 16mb cap",

repl_test:PRIMARY> show dbs
admin                  0.000GB
direct_vote_resource  16.487GB
local                 14.860GB
personas              30.809GB
recommendation         0.370GB
statistics_visit       0.138GB
superpub              75.234GB
test                   0.000GB
repl_test:PRIMARY> use superpub
switched to db superpub
repl_test:PRIMARY> db.ask.count()
123989434
repl_test:PRIMARY> db.ask.find({}).limit(1)
{ "_id" : ObjectId("5b1103341ac2386e164dd796"), "md5" : "b1b791efdb4745e0", "ans                                    wer" : "成本和37砖混的差不多的、、不过保温隔热效果好的", "likenum" : 0, "keyword                                    " : "海容", "question" : "用海容模块建大棚成本高不高??" }
repl_test:PRIMARY> db.ask.distinct("md5").limit(3)
2018-11-23T15:27:29.186+0800 E QUERY    [main] Error: distinct failed: {
        "ok" : 0,
        "errmsg" : "distinct too big, 16mb cap",
        "code" : 17217,
        "codeName" : "Location17217"
} :
DBCollection.prototype.distinct@src/mongo/shell/collection.js:1745:1
@(shell):1:1
repl_test:PRIMARY>

  

repl_test:PRIMARY> db.ask.aggregate([{$match:{}}, {$project:{"md5":true}}, {$group:{_id:"$md5"}}, {$group:{_id:null,                                       count:{$sum:1}}}])
assert: command failed: {
        "ok" : 0,
        "errmsg" : "Exceeded memory limit for $group, but didn't allow external sort. Pass allowDiskUse:true to opt                                        in.",
        "code" : 16945,
        "codeName" : "Location16945"
} : aggregate failed
_getErrorWithCode@src/mongo/shell/utils.js:25:13
doassert@src/mongo/shell/assert.js:16:14
assert.commandWorked@src/mongo/shell/assert.js:370:5
DBCollection.prototype.aggregate@src/mongo/shell/collection.js:1319:5
@(shell):1:1

2018-11-23T15:42:40.779+0800 E QUERY    [main] Error: command failed: {
        "ok" : 0,
        "errmsg" : "Exceeded memory limit for $group, but didn't allow external sort. Pass allowDiskUse:true to opt                                        in.",
        "code" : 16945,
        "codeName" : "Location16945"
} : aggregate failed :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
doassert@src/mongo/shell/assert.js:16:14
assert.commandWorked@src/mongo/shell/assert.js:370:5

 

原文地址:https://www.cnblogs.com/rsapaper/p/10007893.html