So I have this architecture in my db : test1/{test1Id}/test2/{test2Id}
I want to interact with my DB in cloud functions whenever a new one is added :
exports.test = functions.firestore
.document('test1/{test1Id}/test2/{test2Id}')
.onCreate(async (testsnap, context) => {
console.log(testsnap.id);
console.log(test1Id);
});
but test1Id
is then undefined
. How can I access it ?
Thanks ahead.
You must use
context.params.test1Id
All parameters are held under the context object
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With