How can I port my MongoDB to RethinkDB?

How to transfer my MongoDB collections to RethinkDB tables?

I'm not interested in changing my old Mongo _idto Rethink id, because they will be ignored in my implementation, and I'm not worried that they are cluttering my data.

+4
source share
1 answer

I wrote a quick BASH script to solve this problem. Since I only had the RethinkDB JavaScript driver, I had to install the python driver first so that I could use . rethinkdb import

mongo: users, pinboards analytics; BASH:

for collection in users pinboards analytics; \
do \
  mongoexport \
    --host my.mongo.server \
    --db my_mongo_database \
    --collection $collection \
  > $collection.json; \
  rethinkdb import \
    --file $collection.json \
    --table my_rethink_database.$collection; \
  rm $collection.json; \
done

, . , mongoexport rethinkdb import.

, , - !

+12

All Articles