基本上问题又来了:
假设有一个名为“People”的集合。
Firestore 函数可以检测对特定文档的更改,但是是否知道何时使用 firebase 函数将文档(例如“Person1”)添加到集合中?
如果没有,是否有其他方法可以了解何时添加文档?
有一种特定的函数类型,它仅在创建文档时触发。文档中给出了如何使用它的示例:
exports.createUser = functions.firestore .document('users/{userId}') .onCreate((snap, context) => { // Get an object representing the document // e.g. {'name': 'Marie', 'age': 66} const newValue = snap.data(); // access a particular field as you would any JS property const name = newValue.name; // perform desired operations ... });
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句