Description:
I have created a meeting app using ReactJS. In the database, 1 Document contains the data of a single meeting. I want to delete all documents which has been created 2 days. This process can either run all the time in database, or I would prefer, that the process will run every day at 12:00am, which is at night...
const getlink=()=>{
var currentDate = new Date(new Date().getTime() + 48 * 60 * 60 * 1000);
var day = currentDate.getDate()
var month = currentDate.getMonth() + 1
var year = currentDate.getFullYear()
const exp = day + "/" + month + "/" + year
const uid=uuid()
db.collection("rooms").doc(uid).set({
roomId:uid,
expire:exp
})
alert("Your (RoomId) is: \n"+uid+"\n\n⚠️ Your Room will expire on - "+exp)
history.push("/")
}
Above is the code I have used for creating a room and saving to a database...
Note: I am using Functional Components... but not Class Based components.. So please try to provide a Functional based answer
Could anyone please help me figure out how to delete the rooms which has been created before 2 days..