Hi,
I am using a function in scheduled trigger which in turn uses updateMany() method to update the documents based on certain criteria.
exports = async function () {
const collection = context.services
.get(cluster)
.db("scheduler")
.collection("schedules");
const doc = await collection.updateMany(
{
status: "processing",
$expr: {
$gt: [{ $subtract: ["$$NOW", "$scheduleDate"] }, 30 60 1000]
}
},
{
$set: { status: "waiting" }
}
);
};
I want to log the documents before update. Can somebody help me with that?
Thanks