简体   繁体   English

如何在Firebase中的现有节点上插入新值?

[英]How to insert a new value to a existing node in firebase?

I am quite confused about how to insert a new value into an existing node in firebase? 我对如何在Firebase中的现有节点中插入新值感到困惑?

like the pic below, when I try to upload the Route object, I also wanna the uploadedRoute can the Route object's key in. I have tried with setValue, but it will delete the old value, what I want is something like "append" the key, but I really have no idea, could someone give me a hint? 就像下面的图片一样,当我尝试上传Route对象时,我也想能够上传Route对象的键。我尝试了setValue,但是它将删除旧值,我想要的是类似“ append”的键,但我真的不知道,有人可以给我提示吗?

Is this the kind of structure you would like to get ? 您想获得这种结构吗?

在此处输入图片说明

If so, you may try this : 如果是这样,您可以尝试以下方法:

dataRef.child("data/users/\(userID)/Routes/uploadedRoutes/\(routeID)").updateChildValues(["isUploaded": true])

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM