I have set MongoDB and am trying to perform aggregate functions on the MongoDB.
This is what I tried:
var ops = [];
db.tt.aggregate([
{ "$unwind": "$src" },
{ "$group": {
"_id": { "$toLower": "$email" },
"src": { "$addToSet": "$src" },
"ids": { "$addToSet": "$_id" }
}}
],
{
allowDiskUse:true
}).forEach(doc => {
var id = doc.ids.shift();
ops = [
...ops,
{
"deleteMany": {
"filter": { "_id": { "$in": doc.ids } }
}
},
{
"updateOne": {
"filter": { "_id": id },
"update": {
"$set": { "email": doc._id },
"$addToSet": { "src": { "$each": doc.src } }
}
}
},
];
if ( ops.length >= 500 ) {
db.tt1.bulkWrite(ops);
ops = [];
}
});
But the problem is that allowDiskUse:true create _tmp folder to write temporary files. Now, space where my MongDB data is available in not compatible with the temp data. Hence I want to use the external storage for that purpose. Is there a way to specify the temp storage for the process?