将二进制数据从 mongoDB 移动到 rethinkDB
Move binary data from mongoDB to rethinkDB
我正在尝试将数据从 mongo 转移到 rethinkand。到目前为止没有任何效果。
我尝试的第一件事是:
mongoexport -h 127.0.0.1 -d basal -c tickets -o tickets.json
将其导出为 json 然后...
rethinkdb import -f tickets.json --table basal.tickets --format json
将其导入为 json。似乎很容易。虽然不起作用...
我收到这个错误:
0 rows imported in 1 table
ReQL error during 'import': String `ÿØÿá` (truncated) contains NULL byte at offset 8.
ReQL error during 'import': String `PNG
` (truncated) contains NULL byte at offset 9.
ReQL error during 'import': String `ÿØÿá` (truncated) contains NULL byte at offset 8.
ReQL error during 'import': String `PNG
` (truncated) contains NULL byte at offset 9.
Errors occurred during import
有问题的数据是一个带有二进制图像附件的字段。
附件字段如下所示(截断):
{"attach":[{"name":"image001.png","size":20745,"disp":"in
line","cid":"image001.png@01D0411E.BD3054F0","type":"image/png","body":"<U+0089>PNG\r\n\u001a\n\u0000\u0000\u0000\rIHDR\u0000\u0000\u0001>\u0000\u
0000\u0001\u0000\b\u0002\u0000\u0000\u0000¥*<U+008D>º\u0000\u0000\u0000\u0001sRGB ......"} ...]}
关于如何导入具有二进制值的字段有什么想法吗?
RethinkDB 目前不支持字符串中的 NULL 字节。我们提供了一个 r.binary
伪类型来解决这个问题。我要做的是编写一个脚本,逐行读取您的输入数据,对其进行解析,将 'body: '...\u0000...'
替换为该行中的 'body: r.binary('...\u0000...')
,然后插入该行。
我正在尝试将数据从 mongo 转移到 rethinkand。到目前为止没有任何效果。 我尝试的第一件事是:
mongoexport -h 127.0.0.1 -d basal -c tickets -o tickets.json
将其导出为 json 然后...
rethinkdb import -f tickets.json --table basal.tickets --format json
将其导入为 json。似乎很容易。虽然不起作用...
我收到这个错误:
0 rows imported in 1 table
ReQL error during 'import': String `ÿØÿá` (truncated) contains NULL byte at offset 8.
ReQL error during 'import': String `PNG
` (truncated) contains NULL byte at offset 9.
ReQL error during 'import': String `ÿØÿá` (truncated) contains NULL byte at offset 8.
ReQL error during 'import': String `PNG
` (truncated) contains NULL byte at offset 9.
Errors occurred during import
有问题的数据是一个带有二进制图像附件的字段。
附件字段如下所示(截断):
{"attach":[{"name":"image001.png","size":20745,"disp":"in
line","cid":"image001.png@01D0411E.BD3054F0","type":"image/png","body":"<U+0089>PNG\r\n\u001a\n\u0000\u0000\u0000\rIHDR\u0000\u0000\u0001>\u0000\u
0000\u0001\u0000\b\u0002\u0000\u0000\u0000¥*<U+008D>º\u0000\u0000\u0000\u0001sRGB ......"} ...]}
关于如何导入具有二进制值的字段有什么想法吗?
RethinkDB 目前不支持字符串中的 NULL 字节。我们提供了一个 r.binary
伪类型来解决这个问题。我要做的是编写一个脚本,逐行读取您的输入数据,对其进行解析,将 'body: '...\u0000...'
替换为该行中的 'body: r.binary('...\u0000...')
,然后插入该行。