Exporting database from one environment to another environment in MongoDB using Mong dump and Mongo restore

I am new to Mongo Db. I am looking for some help.

Looking for a sample Python or shell script that Need to fetch list of active database from azure sql database and need to check whether those databases exist in mongodb of that environment. Once after verification, export the database exist in primary mongo environment and then import them to a different mongo environment using mongo dump and mongo restore.

Any help would be appreciated.

Is this an automated, or one off?

Regardless, it a fare chunk of work.

Have you got your “active” list of database out of Azure SQL?

Are they named the same as their Mongodb equivalents? Etc etc.

This option in python api may help.

database – Database level operations — PyMongo 3.12.0 documentation

Good luck.

Looking for automated way only. Yes got the active dbs list with query for now but in Azure sql, DB naming will be little different compared to mongodb

You will need to write and script it all yourself, since your requirements are quite bespoke.

This will list the databases on a mongodb server.

Do you have a one to one relationship between mongodb server and database, or many databases on one mongodb server and does that map to your SQL setup?