My current approach is this:
function daysToMillis(days) {
return days * 24 * 3600 * 1000
}
exports = async function() {
const cleanUpTime = Date.now() - daysToMillis(60);
const files = await context.services.get("unciv").db('unciv').collection('UncivServer');
const res = await files.deleteMany({ timestamp: { $lt: cleanUpTime } });
console.log(`${res.deletedCount} documents deleted`);
return res;
};
But I dont want to solely rely on the timestamp. I want to disk used as parameter. How can I do that?