javascript - How to check if the latest document is the same as 30 mins ago? [MongoDB, Node] -
i want implement kind of inactivity check in stream data api log errormessage if last added document in mongodb same 1 30 minutes ago. api recieves data every 3 seconds. can give me little on how achieve this? have thought of setinterval() function repeats every 30 mins, this
var myvar = setinterval(check, 30000); var latestdocu; function check() { if(latestdocu.equals(db.collection.find().sort( { _id : -1 } ).limit(1))[of 30 mins ago]){ console.log('the input idle') } }
Comments
Post a Comment