Hello, i have a trigger function that executes when the user updates a value, inside that function i want to do two more updates but with a delay of 1 min in between, tried putting a sleep(60000) but the part after the sleep is not being executed. How can I achieve this?
await collection.updateOne({_id:changeEvent.documentKey._id},
{
$set:{
rolls_reload_start_time: dateNow,
},
});
console.log("Before sleep")
sleep(60000);
console.log("After sleep")
await collection.updateOne({_id:changeEvent.documentKey._id},
{
$inc:{
rolls:5,
},
})