It runs successfully in mongodb version 5.0+, but fails in version 6.0, why???
version:6.0.6
mongo.log
"planSummary": "COLLSCAN",
"numYields": 225,
"queryHash": "FB805F4B",
"queryFramework": "classic",
"ok": 0,
"errMsg": "PlanExecutor error during aggregation :: caused by :: Out of memory",
"errName": "JSInterpreterFailure",
"errCode": 139,
"reslen": 163,
my code
db.user_103_tmp.aggregate([
{
$project: {
emits: {
k: "$groupid",
v: {
...
}
}
}
},
{
$unwind: "$emits"
},
{
$group: {
_id: "$emits.k",
value: {
$accumulator: {
init: function() {
return {
d: []
};
},
initArgs: [],
accumulate: function(state, values) {
state.d.push(JSON.stringify(values));
return state;
},
accumulateArgs: ["$emits.v"],
merge: function(state1, state2) {
return {
d: state1.d.concat(state2.d)
};
},
finalize: function(state) {
return state.d
},
lang: "js"
}
}
}
},
{
$out: "user_103_group"
}
], {
allowDiskUse: true
})