Thanks, that worked:)
Now that I found the records, can I modify each item to update the status field to wait?
exports = async function () {
const collection = context.services
.get("Cluster0")
.db("test")
.collection("tests3");
const query = {
status: "processing",
$expr: {
$gt: [{
$subtract: ["$$NOW", "$scheduleDate"]
}, 30 * 60 * 1000]
}
};
const projection = {};
const readRecords = await collection.find(query, projection)
.toArray()
.then(items => {
console.log(`Successfully found ${items.length} documents.`)
console.log(JSON.stringify(items));
})
.catch(err => console.error(`Failed to find documents: ${err}`))
}