导入JSON文件而不会覆盖Firebase中的现有数据 [英] Import JSON file without overwriting the existing data in Firebase

查看:147
本文介绍了导入JSON文件而不会覆盖Firebase中的现有数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是否可以通过任何方式将JSON文件导入Firebase中,而无需覆盖现有数据?

Can I know if there is any way I could import my JSON file into Firebase without overwriting the existing data?

推荐答案

您可以在Firebase数据库控制台中的任何位置导入JSON.因此,不仅在根目录下,而且在根目录下的特定路径上,例如/users/users/charlinagnes

You can Import JSON at any location in the Firebase Database console. So not just at the root, but also at a specific path under it, e.g. /users, /users/charlinagnes, etc.

在某个位置导入JSON时,Firebase会执行在该位置进行setValue()操作.因此,它将使用您提供的新JSON覆盖该位置上的现有数据.

When you import JSON at a location, Firebase performs a setValue() operation at that location. So it overwrites the existing data at that location with the new JSON you provide.

没有用于执行任何种类的合并操作的UI.但是幸运的是,Firebase具有广泛的API(毕竟它是开发人员的产品),可让您编写自己的合并逻辑.使用 update() 方法可能会有所帮助这样的合并.

There is no UI for performing any kind of merge operation. But luckily Firebase has an extensive API (it's a developer product after all) that allows you to write your own merge logic. Using the update() method will likely be instrumental to such merging.

这篇关于导入JSON文件而不会覆盖Firebase中的现有数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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