Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function updateDoc(id) {
- admin.firestore().collection('Orders').doc(id).update({status: 2}).then(() => {
- console.log("Document successfully updated!");
- })
- .catch((error) => {
- console.error("Error updating document: ", error);
- });
- }
- exports.updateField = functions.firestore
- .document('/Orders/{id}')
- .onCreate((snapshot, context) => {
- const id = context.params.id;
- setTimeout(updateDoc.bind(id), 30000)
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement