I’m reading the documentation of Extend Cloud Firestore with Cloud Functions link.
The code is as follows
// Listen for changes in all documents in the 'users' collection
exports.useWildcard = functions.firestore
.document('users/{userId}')
.onWrite((change, context) => {
// If we set `/users/marie` to {name: "Marie"} then
// context.params.userId == "marie"
// ... and ...
// change.after.data() == {name: "Marie"}
});
In functions.firestore.document('users/{userId}')
, I don’t really understand the {userId}
.
I know every collection in firestore has a document ID. I have saved my document ID in the field of every user as UID
. So, do I replace the {userId}
with my UID
or I should just use the {userId}
as it it?