如何使用Cloud Functions for Firebase数据库触发器编辑/更新现有数据?
我的用例:我的Firebase数据库中有现有的数据,比如a/{uid}/b,在撰写本文时,我在已经定义了b的数据库中有14-15个uids。现在,我想使用云函数来监听、写入b,并在此基础上添加更多数据。
数据库触发器functions.database.ref('/a/{uid}/b').onWrite将仅针对特定路径的新写入/更新执行,而不针对现有写入/更新执行。
当我想要一次更新现有写入逻辑的所有数据时,Cloud Functions for Firebase如何提供帮助?
我开始使用实时数据库创建我的realtime本地android应用程序,但后来意识到我无法执行一些查询(比如哪里),所以我改到了云防火墙,但我发现将用于实时数据库的代码更改为云防火墙有困难。我把这个用于实时数据库,运行良好。
firebase.database().ref('/users').on('value', (snapshot) => {
let data = snapshot.val();
let items = Object.values(data);
this.setState({items});
}
云修复-云函数:TypeError: collectionRef.child不是一个函数
我正在使用Cloud函数来更新Cloud的父集合中的注释号,所以当注释添加时,云函数可以自动更新注释号。
云修复-云函数:TypeError: collectionRef.child不是对象上的函数(/user_code/index.js:23:33)。(/user_code/node_modules/firebase-functions/lib/cloud-functions.js:112:27) at next (原生) at /user_code/node_modules/firebase-fun
是否可以使用python firebase admin sdk将数据附加到云firestore数据库中的子集合?如果是这样的话,我错过了什么? 我正在尝试将数据附加到位于googles云firestore中的特定文档的子集中-而不是实时数据库。我已经做了大量的研究,到目前为止,这是最流行的资源:add data to firestore,它并没有明确表示这是不可能的 我能够创建文档、阅读文档等,但在没有获得整个文档的情况下,我似乎无法追加或访问子集合 我的代码流程如下: import time
import json
import firebase_admin
from firebase_a
我试图使用云任务,每分钟执行一个云功能。想象一下,这里有一个有200万份文档的集合。所以我每分钟都要看这本藏书。
Document 1-->
PerformAt: 3rd of September 2021 at 09:00AM
Status: Scheduled
Document 2-->
PerformAt: 3rd of September 2021 at 01:00PM
Status: Scheduled
Document 3-->
PerformAt: 2nd of September 2021 at 03:00PM
我希望在firebase中创建一个云功能,每当用户第一次登录时就会触发它。该函数需要将特定用户身份验证中的UID添加到防火墙中已经存在的特定文档中。问题是UID需要添加到我不知道位置的文档中。我现在的代码并没有完全做到这一点,但这是它出错的地方。简化后的数据库如下所示
organisations
[randomly generated id]
people
[randomly generated id] (in here, a specific document needs to be found based on known email
我正在尝试构建一个Firebase云函数,为用户生成一个仪器部件。云函数应该在应用中调用,生成部件,然后将生成的部件返回给应用进行记录。
下面是我的App函数:
public void addInstrumentToMix() {
//Allow the user to select an instrument
//once the user has seleced there instrument generate that instruments part
//call firebase cloud function to g