1

I'm trying to get the uid of the user, the uid is in the path of the document that has been changed but not sure how to extract it from the path?

  exports.watchTodos = functions.firestore.document('users/{uid}/todos/{docId}')
        .onUpdate(async (snap, context) => {
            // get the uid of the user
            const uid = await context.auth?.uid
            console.log(uid)
  }
Gerry
  • 1,159
  • 1
  • 14
  • 29
  • What you're trying to do is not supported for Firestore triggers. You will need to put the uid in the document and check it with security rules. – Doug Stevenson Jun 17 '20 at 07:00
  • @DougStevenson Okay, could I some extract it from the path that was changed as the document is nested in user id?? How could I do this? – Gerry Jun 17 '20 at 07:07
  • Please read the marked duplicates first, and if you have a new question, please post it separately to explain what you're trying to do now. – Doug Stevenson Jun 17 '20 at 15:04

0 Answers0