Create an event that performs cleaning task in mongodb

0

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.

    
asked by mike 23.02.2018 в 18:00
source

0 answers