📅  最后修改于: 2022-03-11 14:55:19.948000             🧑  作者: Mango
var pipeline = [
{$lookup:{
from: "files",
localField: "files_id",
foreignField: "_id",
as: "file"
}
},
{$match:{
"file.uploadDate":
{
$lt: ISODate("2017-06-10T00:00:00.000Z")
}
}
}
];
var cursor = db.chunks.aggregate(pipeline);
var chunkIds = cursor.map(function (chunk) { return chunk._id; });
db.chunks.remove({"_id": { "$in": chunkIds }});