我尝试使用聚合来计算具有相同normalized_link
它给了我key too large to index
,而且似乎normalized_link \"http://www.funpepper.com/share/game/?infos=OtnZDeyCWe5oR-ziY_-p...\"
的值太长了。
然而,值\"http://www.funpepper.com/share/game/?infos=OtnZDeyCWe5oR-ziY_-p...\"
是我想要计算的
我怎么能这样做?感谢
{
"errmsg": "exception: insert for $out failed: { connectionId: 1, err: \"Btree::insert: key too large to index, failing alibuddha.tmp.agg_out.2.$_id_ 1208 { : \"http://www.funpepper.com/share/game/?infos=OtnZDeyCWe5oR-ziY_-p...\", code: 17280, n: 0, ok: 1.0 }",
pipeline = [
{
'$project': {
'doc': '$$ROOT',
'id': '$$ROOT.ID',
'normalized_link': '$$ROOT.normalized_link'
}
},
{ "$group": {
"_id": "$doc.normalized_link",
"frequency": { "$sum": 1 }
}},
{
'$project': {
'count': '$count',
}
}, {
'$out': "stats_records"
}
]
db["comments"].runCommand('aggregate', {
pipeline: pipeline,
allowDiskUse: true
});