如何在不覆盖FireBase RealTimeDB中现有对象的情况下导入Json数组

问题描述:

我使用此功能将大量JSON文件导入到FireBase数据库控制台: https://github.com/firebase/firebase-import

I import a large amount of JSON files to my FireBase DB console with this feature: https://github.com/firebase/firebase-import

当我上传带有很多对象的数组时,它工作得很好, 但是如果我想将一个新的数组对象上载到现有表中,它将覆盖现有对象而不是添加新对象.

It works well when I upload arrays with lots of objects, but if i want to upload a new array object to existing table, it overrides the existing object instead of adding the new one.

我很乐意找到使用firebase-import或任何其他工具将新对象更新"到现有表的正确方法.

I would be happy to find a right way to "Update" the new objects to the existing table with firebase-import or any other tool.

Jen指出,您可以使用

As pointed out by Jen, you can use the Firebase CLI to update objects in your database. Just use this command:

firebase database:update /path/to/object -d newArray.json

其中:

  • /path/to/object-您要更新的对象的路径.
  • newArray.json-包含具有新值的数组的json文件.
  • /path/to/object - the path of the object that you want to update.
  • newArray.json - the json file containing the array with the new values.