从MongoDB导入Firebase [英] Import into Firebase from MongoDB

查看:175
本文介绍了从MongoDB导入Firebase的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将MongoDB集合导入Firebase。我使用命令 mongoexport -d RxData -c rxInfos -o rx_export.json 在mongo中创建了导出文件。当我尝试将文件导入Filebase时,我收到错误解析JSON数据时出错。请验证您的输入。

I am trying to import a MongoDB collection into Firebase. I have created an export file in mongo using the command mongoexport -d RxData -c rxInfos -o rx_export.json. When i try to import the file into Filebase, i get the error Error parsing JSON data. Please validate your input.

我假设因为Firebase在MongoDB上显示,这只是一个简单的导出 - >导入过程。有没有我在这里缺少的东西?

I was assuming that because Firebase is bulit on MongoDB that it would just be a simple export --> import process. Is there something that I am missing here?

导出文件在这里可用,大约是200 MB。

The export file is available here and is ~ 200 MB.

http://www.filedropper.com/rxexport 1

推荐答案

快速浏览您上传和链接的文件 rx_export.json ,有一些问题:

Taking a quick look at the file rx_export.json that you uploaded and linked, there are a few problems:


  • 该文件作为一个整体是无效的,虽然每行都是有效的JSON本身。如果您逐行查看文件,您将看到以下内容,其中缺少周围的对象,每个子对象的键以及分隔每个小孩的逗号:

  • The file is not valid JSON as a whole, though each line is valid JSON by itself. If you take a look at the file line-by-line, you'll see the following, which is lacking a surrounding object, keys for each child object, and commas delimiting each child:

{ "_id" : { "$oid" : "<id1>" }, ... }
{ "_id" : { "$oid" : "<id2>" }, ... }


  • 此外,Firebase目前强加了一些关键限制(见 https://www.firebase.com/docs/creating-references.html )和以下是不允许的,虽然有些文件存在于您的文件中:

  • Also, Firebase currently imposes some key restrictions (see https://www.firebase.com/docs/creating-references.html) and the following are not permitted, though some are present in your file:


    • (期间)

    • $ (美元符号)

    • (左方括号)

    • ] (右方括号)

    • (哈希或英镑)

    • / 斜杠)

    • . (period)
    • $ (dollar sign)
    • [ (left square bracket)
    • ] (right square bracket)
    • # (hash or pound sign)
    • / (forward slash)

    这篇关于从MongoDB导入Firebase的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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