将Cloud Functions与Firebase实时数据库一起使用时,您可以使用云功能定位特定字段.例如,给定这个JSON结构,我可以定位user1的电子邮件字段是否通过('/user/{userId}/email').onUpdate云功能更改.
{
"user": {
"user1": {
"name": "John Doe",
"phone": "555-5555",
"email": "john@gmail.com"
}
}
}
现在使用Firestore,我似乎无法定位特定字段,只能定位文档.如果是这种情况,定位电子邮件字段的Firestore云功能必须如下所示 ('/user/{userId}').onUpdate,并且每次user集合中的任何文档发生更改时都会触发.这将导致大量浪费的云功能触发.这就是Firestore的工作方式吗?它有一个优雅的工作吗?
database database-design firebase google-cloud-functions google-cloud-firestore