Mongodb Mongoimport 太大:失败解析错误 [英] Mongodb Mongoimport too large: Failure parsing errors

查看:40
本文介绍了Mongodb Mongoimport 太大:失败解析错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试导入 MongoDB 70 mb 有效的 json 文件.但是,我在循环中一遍又一遍地收到此错误:

 01 11:42:20 异常:提供的 JSON 的 BSON 表示太大:解析 JSON 字符串附近的失败:名称":L01 11:42:2001 11:42:20 断言:10340:解析 JSON 字符串附近失败:链接":h01 11:42:20 mongoimport.exe ???01 11:42:20 mongoimport.exe ???01 11:42:20 mongoimport.exe ???01 11:42:20 mongoimport.exe ???01 11:42:20 mongoimport.exe ???01 11:42:20 mongoimport.exe ???01 11:42:20 mongoimport.exe ???01 11:42:20 kernel32.dll BaseThreadInitThunk+0x1201 11:42:20 ntdll.dll RtlInitializeExceptionChain+0xef01 11:42:20 异常:提供的 JSON 的 BSON 表示太大:解析 JSON 字符串附近失败:链接":h01 11:42:2001 11:42:20 断言:10340:解析 JSON 字符串附近失败:}01 11:42:20 mongoimport.exe ???01 11:42:20 mongoimport.exe ???01 11:42:20 mongoimport.exe ???01 11:42:20 mongoimport.exe ???01 11:42:20 mongoimport.exe ???01 11:42:20 mongoimport.exe ???01 11:42:20 mongoimport.exe ???01 11:42:20 kernel32.dll BaseThreadInitThunk+0x1201 11:42:20 ntdll.dll RtlInitializeExceptionChain+0xef01 11:42:20 异常:提供的 JSON 的 BSON 表示太大:解析附近的 JSON 字符串失败:}01 11:42:2001 11:42:20 断言:10340:解析 JSON 字符串附近失败:],01 11:42:20 mongoimport.exe ???01 11:42:20 mongoimport.exe ???01 11:42:20 mongoimport.exe ???01 11:42:20 mongoimport.exe ???01 11:42:20 mongoimport.exe ???01 11:42:20 mongoimport.exe ???01 11:42:20 mongoimport.exe ???01 11:42:20 kernel32.dll BaseThreadInitThunk+0x1201 11:42:20 ntdll.dll RtlInitializeExceptionChain+0xef01 11:42:20 异常:提供的 JSON 的 BSON 表示太大:解析附近的 JSON 字符串失败:],

我的 JSON(只是其中的一个小例子)包含许多这样的结构:

<预><代码>[{数据": ["id": "xxxxxxxxxxxxxxxxxx",从": {"name": "yyyyyyyyyyy",id":11111111111111"},到": {数据": [{版本":1,"name": "11111111111111",id":11111111111111"}]},"图片": "ffffffffffffffffffffffff.jpg","link": "http://www.youtube.com/watch?v=qqqqqqqqqqqqq","source": "http://www.youtube.com/v/qqqqqqqqqqqqq?version=3&autohide=1&autoplay=1","name": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","description": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...","icon": "http://static.ak.fbcdn.net/rsrc.php/v2/xxx/r/dddd",行动":[{"name": "评论",链接":http://www.example.com/1111111111111/posts/1111111111111"},{"name": "喜欢",链接":http://www.example.com/1111111111111/posts/1111111111111"}],隐私": {价值": ""},"类型": "视频",created_time":1356953890,更新时间":1356953890,喜欢":{数据": [{"name": "jjj ","id": "59xxx67"},{"name": "xxxxxx",id":79xxx27"}],计数":2},评论": {计数":0}},............}]

这是json的一般模式":

<预><代码>[{数据": [{}],分页":{"上一个": "链接",下一个":链接"}},数据": [{}],分页":{"上一个": "链接",下一个":链接"}},数据": [{}],分页":{"上一个": "链接",下一个":链接"}}]

解决方案

代替使用:

mongoimport -d DATABASE_NAME -c COLLECTION_NAME --file YOUR_JSON_FILE

使用以下命令:

mongoimport -d DATABASE_NAME -c COLLECTION_NAME --file YOUR_JSON_FILE --jsonArray

I am trying to import into MongoDB 70 mb json file that is valid. But, I am getting this error over and over in a loop:

 01 11:42:20 exception:BSON representation of supplied JSON is too large: Failure parsing JSON string near: "name": "L
 01 11:42:20
 01 11:42:20 Assertion: 10340:Failure parsing JSON string near: "link": "h
 01 11:42:20 mongoimport.exe    ???
 01 11:42:20 mongoimport.exe    ???
 01 11:42:20 mongoimport.exe    ???
 01 11:42:20 mongoimport.exe    ???
 01 11:42:20 mongoimport.exe    ???
 01 11:42:20 mongoimport.exe    ???
 01 11:42:20 mongoimport.exe    ???
 01 11:42:20 kernel32.dll       BaseThreadInitThunk+0x12
 01 11:42:20 ntdll.dll          RtlInitializeExceptionChain+0xef
 01 11:42:20 exception:BSON representation of supplied JSON is too large: Failure parsing JSON string near: "link": "h
 01 11:42:20
 01 11:42:20 Assertion: 10340:Failure parsing JSON string near: }
 01 11:42:20 mongoimport.exe    ???
 01 11:42:20 mongoimport.exe    ???
 01 11:42:20 mongoimport.exe    ???
 01 11:42:20 mongoimport.exe    ???
 01 11:42:20 mongoimport.exe    ???
 01 11:42:20 mongoimport.exe    ???
 01 11:42:20 mongoimport.exe    ???
 01 11:42:20 kernel32.dll       BaseThreadInitThunk+0x12
 01 11:42:20 ntdll.dll          RtlInitializeExceptionChain+0xef
 01 11:42:20 exception:BSON representation of supplied JSON is too large: Failure parsing JSON string near: }
 01 11:42:20
 01 11:42:20 Assertion: 10340:Failure parsing JSON string near: ],
 01 11:42:20 mongoimport.exe    ???
 01 11:42:20 mongoimport.exe    ???
 01 11:42:20 mongoimport.exe    ???
 01 11:42:20 mongoimport.exe    ???
 01 11:42:20 mongoimport.exe    ???
 01 11:42:20 mongoimport.exe    ???
 01 11:42:20 mongoimport.exe    ???
 01 11:42:20 kernel32.dll       BaseThreadInitThunk+0x12
 01 11:42:20 ntdll.dll          RtlInitializeExceptionChain+0xef
 01 11:42:20 exception:BSON representation of supplied JSON is too large: Failure parsing JSON string near: ],

My JSON ( only small example from it ) consist many many structures like this one :

[ 
{
   "data": [
         "id": "xxxxxxxxxxxxxxxxxx",
         "from": {
            "name": "yyyyyyyyyyy",
            "id": "1111111111111"
         },
         "to": {
            "data": [
               {
                  "version": 1,
                  "name": "1111111111111",
                  "id": "1111111111111"
               }
            ]
         },
         "picture": "fffffffffffffffffffffff.jpg",
         "link": "http://www.youtube.com/watch?v=qqqqqqqqqqqqq",
         "source": "http://www.youtube.com/v/qqqqqqqqqqqqq?version=3&autohide=1&autoplay=1",
         "name": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
         "description": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...",
         "icon": "http://static.ak.fbcdn.net/rsrc.php/v2/xxx/r/dddd",
         "actions": [
            {
               "name": "Comment",
               "link": "http://www.example.com/1111111111111/posts/1111111111111"
            },
            {
               "name": "Like",
               "link": "http://www.example.com/1111111111111/posts/1111111111111"
            }
         ],
         "privacy": {
            "value": ""
         },
         "type": "video",
         "created_time": 1356953890,
         "updated_time": 1356953890,
         "likes": {
            "data": [
               {
                  "name": "jjj ",
                  "id": "59xxx67"
               },
               {
                  "name": "xxxxx",
                  "id": "79xxx27"
               }
            ],
            "count": 2
         },
         "comments": {
            "count": 0
         }
      },

....
....
....
}
]

this is the general patern of the json ":

[
{
   "data": [
      {

      }
    ],
    "paging": {
      "previous": "link",
      "next": "link"
   }
},
   "data": [
      {
      }
    ],
    "paging": {
      "previous": "link",
      "next": "link"
   }
},
"data": [
      {
      }
    ],
    "paging": {
      "previous": "link",
      "next": "link"
   }
}
]

解决方案

Instead of using:

mongoimport -d DATABASE_NAME -c COLLECTION_NAME --file YOUR_JSON_FILE

use the following command:

mongoimport -d DATABASE_NAME -c COLLECTION_NAME --file YOUR_JSON_FILE --jsonArray

这篇关于Mongodb Mongoimport 太大:失败解析错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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