Migrating from mongodb to cockroachdb

We want to migrate from MongoDB to Cockroach DB. Can you please let us know how can we do it. Since Cockroach DB supports JSON, can we put mongodb docs into JSON.
How can i import this JSON file into Cockroach DB.

Is there any better approach for the same.


Hey @Infyravi

In order to migrate from MongoDB to CockroachDB, one thing you could try is to export your MongoDB data into a CSV, following the documentation here. Once you have the CSV, that can be used for an import of the data as we describe in our documentation here. Bear in mind that you will need to create a table in the IMPORT TABLE command, as this table cannot exist before the import.

This isn’t formally documented yet, so while this may work, there may be other things that pop up in this process. Also, if there is anyone out in forum land who has done this and can add some additional info, it would be appreciated. Let me know how it works out, and I will bring this up with our documentation team to see if some docs can be written up for this process.

Let me know how it works! :drum:

I can imagine that the database is a bit large … If so, it might be smarter to write some code to read the data from the source and write to cdb. It will take some time, depending on the size … In that case first create the schema in cdb.

Thanks a lot for sharing the valuable information