无法通过控制台将节点添加到 Firebase [英] Cannot add node to Firebase through console
问题描述
我有一个包含 2 个移动应用的 Firebase 项目:
I have a Firebase project with 2 mobile apps:
- 来自 Firebase/Google 的FriendlyChat 示例(消息) - 首先创建
- 杂货清单 (grocery-items) - 尝试创建第二个
您可以看到消息节点已经存在,其中包含一些测试消息.
You can see the messages node already there with some test messages inside.
但是当我尝试将子项添加到 appId
节点时,我将其命名为grocery-items",然后单击 ADD,但是该节点会没有被添加.它只是消失了.
But when I try to add a child to the appId
node, I give it a name "grocery-items" and I click on ADD, but the node does not get added. It just disappears.
为什么我不能添加杂货节点?
Why can't I add the grocery-items node?
推荐答案
Firebase 数据库是一个键值存储.它将键的值存储在树中的路径中.但它仅在键具有实际值时才存储键.如果键/路径没有值,则立即将其删除.
The Firebase Database is a key-value store. It stores the values of keys at paths in the tree. But it only stores keys when they have an actual value. If there is no value for a key/path, it is immediately deleted.
因此,如果您单击 + 按钮,然后输入一个密钥并单击 添加 按钮,它将删除您输入的第一个密钥因为它不会没有价值.
So if you click the + button, then enter a key and click the Add button, it will delete the first key that you entered because it doesn't have a value.
你应该做什么取决于你想要完成什么.
What you instead should do depends on what you want to accomplish.
添加单个键/值对:
- 点击+
- 输入密钥/名称
- 输入一个值
- 点击添加
如果你想添加一个 JSON 片段/树:
If you want to add a JSON snippet/tree:
- 点击+
- 输入密钥/名称
- 点击(空)值旁边的 +
- 输入孩子的钥匙/名字
- 为孩子输入一个值
- 点击添加
这篇关于无法通过控制台将节点添加到 Firebase的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!