Database Migration from MongoDB to PostgreSQL in GCP

We are trying to migrate the mongodb to the PostrgrSQL in GCP. For this we have exported the mongodb database table into CSV files. When we import these CSV files into the PostrgreSQL in Google Cloud platform, the tables in the csv are not matching with the number of tables imported. Is there any better way to migrate the mongoDB to the PostgreSQL (Google CLoud Platform)?

There won’t be an easy way to do a one-to-one migration like that as the ID structure in MongoDB is different (ObjectIDs vs integers) and the relationship table structure is entirely different also.

You may need to implement some customized migrations scripts reading from the CSVs and rebuilding a new one in the PG format. There may also being some tooling out there but since we (Strapi) have never used child documents they may not work.

This is one of the main reasons we are dropping MongoDB support in the v4:

1 Like

thanks. but is there any proven way to do this before strapi drops the support for MongoDB? How are the enterprises using strapi with MongoDB migrating out before strapi drops the support for MongoDB?

1 Like

As we only recently alerted them they are all still in planning phases and we haven’t even started detailed conversations yet. We will be building documentation and tooling on migrating later this year but not likely to happen until after the v4 beta as we don’t even have the v4 database changes entirely planned yet as we are still in a design phase. (We haven’t even released the RFC for it :stuck_out_tongue: )

makes sense and we should wait. :slight_smile:
Also we are trying to move strapi to GCP. Do you suggest to use GCP App Engine or cloud run? We wanted cloud run because of the serverless container that we wanted to use

Never tested cloud run, I’ve messed with compute (just basic virtual machines) and our App Engine documentation was written by someone in the community and I’ve seen some issues around it.

My recommendations won’t really be super valid here as I have a personal bias towards using virtual machines (VPSes) as I much prefer automation via Terraform and Ansible.

We will have a hard requirement (for supported databases) of either PG, MySQL, or MariaDB on any platform.

If you can get it to work on others that’s fine but we (the Strapi team) can’t help you and we won’t allow for GitHub bug reports for issues on other databases.

ok. understand
also we think strapi provides NPM modules for import and export

will this avoid the complexity of converting a database from one format to another?