我正在尝试在执行此命令时通过 json 文件将 json 数据导入 mongo
mongoimport --db my_db --collection m_data --type json --file /home/uname/email_my.json -v
我有一个完整的 html 存储为我的关键值之一,其中包含许多特殊字符。我收到以下错误
Tue Aug 27 00:04:48 exception:BSON representation of supplied JSON is too large: Failure parsing JSON string near: </td>
Tue Aug 27 00:04:48 Assertion: 10340:Failure parsing JSON string near: <td>
0x85a4462 0x8584704 0x8571e83 0x8571f35 0x8385c96 0x81f5cf2 0x81f73cc 0x81e89a1 0x81de4ec 0xb70dc935 0x81ea5cd
Tue Aug 27 00:04:48 Assertion: 10340:Failure parsing JSON string near: <br />
0x85a4462 0x8584704 0x8571e83 0x8571f35 0x8385c96 0x81f5cf2 0x81f73cc 0x81e89a1 0x81de4ec 0xb70dc935 0x81ea5cd
mongoimport(_ZN5mongo15printStackTraceERSo+0x32) [0x85a4462]
mongoimport(_ZN5mongo10logContextEPKc+0x64) [0x8584704]
mongoimport(_ZN5mongo11msgassertedEiPKc+0xb3) [0x8571e83]
mongoimport() [0x8571f35]
mongoimport(_ZN5mongo8fromjsonEPKcPi+0x256) [0x8385c96]
mongoimport(_ZN6Import8parseRowEPSiRN5mongo7BSONObjERi+0x102) [0x81f5cf2]
mongoimport(_ZN6Import3runEv+0xebc) [0x81f73cc]
mongoimport(_ZN5mongo4Tool4mainEiPPc+0x7c1) [0x81e89a1]
mongoimport(main+0x3c) [0x81de4ec]
/lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0xb70dc935]
mongoimport() [0x81ea5cd]
Tue Aug 27 00:04:48 exception:BSON representation of supplied JSON is too large: Failure parsing JSON string near: <br />
我也试过
mongoimport --db my_db --collection m_data --type json --file /home/uname/email_my.json --jsonArray
但它跳过了我所有的键值,其中包含 HTML。任何关于如何导入此类数据的建议。注意-我无法从 json 文件中删除任何内容,因为我想按原样存储它。有什么建议吗?提前致谢。
更新 我正在尝试插入以下类型的 json
{"id": 771564,"mailbox_id": 93,"temp": 0,"toaddress": "address <abc@xyz.com>","to_addr": "abc@xyz.com","fromaddress": "name <noreply@somesmtp.com>","from_addr": "noreply@somesmtp.com","ccaddress": "","cc": "","bccaddress": "","bcc": "","reply_toaddress": "xyz@yahoo.com","reply_to": "xyz@yahoo.com.au","senderaddress": "Lisa Taylor <noreply@somesmtp.com>","sender": "noreply@somesmtp.com","return_pathaddress": "","return_path": "","email_date": "2013-08-26 14:01:02","subject": "E_form:- some date, 186","flagged": " ","draft": " ","msgno": 18,"MailDate": "0000-00-00 00:00:00","email_size": 13940,"udate": 1377525675,"email_body_txt": "
","email_body_html": "<table width=\"800\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">
<tr>
<td>
<a href=\"http://www.google.com/\" title=\"\"><img src=\"http://www.example.com/images/frontend/logo.png\" width=\"163\" height=\"116\" alt=\"a\" title=\"a\" border=\"0\" /></a>
</td>
</tr>
<tr>
<td>
<table width=\"800px\" border=\"0\">
<tr>
<td>
<a href=\"http://www.example.com/\" title=\"\">Home</a>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\">
<tr>
<td height=\"39\" colspan=\"3\"><b>Dear Admin,<br />
</b><br />
<b>addf.<br />
</b></td>
</tr>
</table>","unique_msg_no": 246485,"attach_fname": "","domain_id": 0,"myob": 0,"tags": "","form_id": 0,"hashid": "0000-00-00 00:00:00","flag": 1,"domain_name": "","myob_name": "","server_id": 0,"server_name": "","status": 1,"ft_js_id": 0,"response_type": 0},