无法通过控制台将节点添加到Firebase [英] Cannot add node to Firebase through console

查看:157
本文介绍了无法通过控制台将节点添加到Firebase的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我拥有一个包含两个移动应用的Firebase项目:


  1. Firebase / Google的FriendlyChat示例>
  2. 杂货物品清单(杂货物品) - 尝试创建第二个元素

您可以看到消息节点已经有一些内部的测试信息。





但是当我尝试向 appId 节点添加一个子项时,我将其命名为grocery-items,然后单击 ADD ,但是节点不会被添加。它只是消失。

为什么我不能添加grocery-items节点?解决方案

/ div>

Firebase数据库是一个键值存储。它将密钥的值存储在树中的路径中。但是只有当它们具有实际价值时才存储密钥。如果键/路径没有值,则立即删除。所以如果你点击 + 按钮,然后输入一个密钥然后点击添加按钮,它将会删除您输入的第一个键,因为它没有值



您应该做什么取决于您想要完成的操作。

添加一个键/值对:


  • 点击

  • 输入密钥/名称

  • 输入值

  • >添加



如果您想添加JSON片段/树:


  • 点击 +

  • 输入密钥/名称
  • (空)价值
  • 旁边的 + 为子女输入一个密钥/名称
  • 孩子

  • 点击添加


I have a Firebase project with 2 mobile apps:

  1. FriendlyChat example from Firebase/Google (messages) - created first
  2. Grocery Items list (grocery-items) - trying to create second

You can see the messages node already there with some test messages inside.

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?

解决方案

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.

To add a single key/value pair:

  • click the +
  • enter a key/Name
  • enter a Value
  • click Add

If you want to add a JSON snippet/tree:

  • click the +
  • enter a key/Name
  • click the + next to the (empty) Value
  • enter a key/Name for the child
  • enter a Value for the child
  • click Add

这篇关于无法通过控制台将节点添加到Firebase的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆