Advertisement
Guest User

Firebase Upload

a guest
Feb 24th, 2022
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function updateDoc(id) {
  2.     admin.firestore().collection('Orders').doc(id).update({status: 2}).then(() => {
  3.         console.log("Document successfully updated!");
  4.     })
  5.     .catch((error) => {
  6.         console.error("Error updating document: ", error);
  7.     });
  8. }
  9.  
  10. exports.updateField = functions.firestore
  11.     .document('/Orders/{id}')
  12.     .onCreate((snapshot, context) => {
  13.         const id = context.params.id;
  14.       setTimeout(updateDoc.bind(id), 30000)
  15.     });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement