I am trying to move data from mongo to rethinkand. Nothing works so far. The first thing I tried was this:
mongoexport -h 127.0.0.1 -d basal -c tickets -o tickets.json
Export it as json and then ...
rethinkdb import -f tickets.json --table basal.tickets --format json
Import it as json. Seems easy. Does not work though...
I get this error:
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
The problematic data in question is a field with a binary image attachment.
The attachment field looks like this (truncated):
{"attach":[{"name":"image001.png","size":20745,"disp":"in
line","cid":"[email protected]","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 ......"} ...]}
Any ideas on how I could import fields with binary values?
RethinkDB doesn't currently support NULL bytes in strings. We offer an r.binary pseudotype to get around that. What I would do is write a script that reads your input data row by row, parses it, replaces 'body: '...\u0000...' with 'body: r.binary('...\u0000...') in that row, and then inserts that row.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With