【发布时间】:2020-04-23 01:26:36
【问题描述】:
我现在需要开始为我在 Firestore 中的数据设置规则。然而,在我的网络应用程序中,虽然我直接从 Firestore 查询数据,但我几乎从不直接向它写入数据。所有写入均通过云功能完成:
exports.post_content = functions.https.onRequest((request, response) => {
db.collection(...)...().add(..)
.then(...)
.catch(...)
});
还有一些通过触发器函数写入数据的情况:
exports.on_content_write = functions.firestore.document('abc/xyz/...').onCreate(..);
我在 Firestore 规则中找到的几乎所有文档或教程都假定数据是由经过或未经过身份验证的 Web 用户写入(或读取)的。但是当通过 http 请求(例如post_content)进行写入时,哪个“用户”正在检查 Firestore?由于 post_content 本身由客户端调用(通过 Web 或 curl 或其他方式),这些凭据是否会传递给 firestore?
函数什么时候自动触发?
【问题讨论】:
标签: firebase google-cloud-firestore google-cloud-functions