export const product = functions.firestore
.document("shops/{shopId}/products/{prodId}")
.onCreate(async (snap, context) => {
let productId = snap.id;
})
我想在创建触发器时从此访问shopId
。有什么办法让它吗
您可以执行以下操作来访问通配符:
export const product = functions.firestore
.document("shops/{shopId}/products/{prodId}")
.onCreate(async (snap, context) => {
let productId = snap.id;
let shopId = context.params.shopId;
})
https://firebase.google.com/docs/functions/firestore-events