I want to create a firebase function that would delete or update a document after 24 hours like Instagram stories. Would this implementation work?
// 24 hours in miliseconds
const time = 24 * 60 * 60 * 1000;
exports.updateUser = functions.firestore
.document('users/{id}')
.onUpdate((change, context) => {
setTimeout(() => {
// Delete or update doc
}, time);
});