firebase - FieldValue arrayUnion 和 Cloud FireStore 与 Flutter
全部标签 我有很多这样的child的parent:Parent:{"childe1":"data","childe2":"data","childe3":"data","childe4":"data","childe5":"data"}我怎样才能同时更新child[childe1,childe2,childe3],防止任何其他用户同时更新它们? 最佳答案 要同时更新多个属性,您可以运行update()调用:ref.child("Parent").update({childe1:"newdata",childe2:"newdata",child
我在firebase中有这样的数据:"application":{"companies":{"firebase":{"creation":{"name":"FirebaseInc","location":"USA"},"google":{"creattion":{"name":"GoogleInc","location":"USA"}}"facebook":{},"apple":{}}}}companies键下有数万条记录。我如何有效地执行以下查询?如何只查询其名称下存在键creation的记录?如何只查询名称下没有键creation的记录?我还想对返回的结果集调用.on('child
我有3个带有键的对象,如下所示:它们的格式为YYYYMMDD。我正在尝试获取一个月的数据。但我没有得到所需的输出。当我这样查询时:varref=db.child("-KPXECP6a1pXaM4gEYe0");ref.orderByKey().startAt("20160901").once("value",function(snapshot){console.log("objects:"+snapshot.numChildren());snapshot.forEach(function(childSnapshot){console.log(childSnapshot.key);});
我有一个JavaScript应用程序在我的桌面Chrome浏览器中运行,它正在读取和写入Firebase。我想了解它使用了多少流量(与任何本地缓存相比),我想我可以在ChromeInspector中查看。我没有看到任何此类流量。我想我需要调整一些Inspector设置,但看起来我已经打开了所有东西,没有过滤任何东西。如何查看此流量?(对于我目前的简单需求,我更愿意在Chrome中这样做,而不必启动WireShark) 最佳答案 Firebase使用网络套接字与客户端通信。在devtool的网络选项卡中,按“WS”(websocket
我正在为一个网络应用程序登录,我已经做到了,所以用户可以使用他们的电子邮件和密码手动登录,或者使用谷歌登录。有没有办法确定他们使用的方法?最好使用Firebase身份验证状态更改功能。`firebase.auth().onAuthStateChanged(firebaseUser=>{....`我知道您可以在进入Firebase控制台日志时知道他们是如何登录的,但是有没有办法使用JavaScript代码来确定它?当使用firebase.auth().currentUser.providerData时: 最佳答案 @mjrdnk的回答
所以我有一个调用2个异步函数的Firebase云函数。exports.someFunction=functions.firestore.document('some/path').onCreate(event=>{asyncFunction1();asyncFunction2();});asyncFunction1和asyncFunction2都返回一个promise。现在,Firebasedictates我们应该Resolvefunctionsthatperformasynchronousprocessing(alsoknownas"backgroundfunctions")byre
我正在尝试对事务使用异步/等待。但是出现错误“参数“updateFunction”不是有效函数。”vardocRef=admin.firestore().collection("docs").doc(docId);lettransaction=admin.firestore().runTransaction();letdoc=awaittransaction.get(docRef);if(!doc.exists){throw("docnotfound");}varnewLikes=doc.data().likes+1;awaittransaction.update(docRef,{li
我对Jest单元测试很陌生,所以像模拟模块这样的东西令人困惑。在reactnative中,有一个组件使用firebase数据库从给定的ref返回数据://whenthedataofthecurrentuserisavailableuserRef.child(user.uid).on('value',snap=>{//checkofval()consistsdataif(snap.val()){letauthUser=snap.val(),isPatient=authUser.type==="Patient",//Weupdatethestateobjectsothatthecompon
问题如何将async辅助方法添加到CloudFunctionsindex.js文件中?在将fs.writefile转换为Promise时,需要一个async函数才能使用await,如本文所述StackOverflow帖子:fs.writeFileinapromise,asynchronous-synchronousstuff.但是,lint不赞成在exports函数之外向index.js文件添加额外的方法。错误第84行引用辅助函数asyncfunctionwriteFile。Users/adamhurwitz/coinverse/coinverse-cloud-functions/fu
让我们采用以下数据结构:现在我想用Firebase函数刷新accessTokenFacebook。我测试了两个选项:onWrite和:onChangedonWrite对我来说看起来最好,但具有以下功能:exports.getFacebookAccessTokenOnchange=functions.database.ref('/users/{uid}/userAccountInfo/lastLogin').onWrite(event=>{constlastLogin=event.data;letdateObject=newDate();letcurrentDate=dateObject