I am new to mongodb and I was looking for the possibility of creating a function that runs every so often in mongodb but I have not achieved something like this:
setTimeOut(function () {
db.getCollection('events').findAndModify({"query":{"status":false},"update":{"status":true}},{})
},2000);
Can it be done? I look for similar functions MySql events.
Thank you.