Moving from MLab to MongoDB

I have a free DB in mLab that I would like to move to my new MongoDB paid instance. How do I go about that? #covid-19

Welcome to the forum @Stephen_Wright!

There’s a comprehensive Guide to Migrating to Atlas from mLab.

For a free tier cluster, the short scoop is that you should use mongodump to take a backup of your mLab deployment and then mongorestore into your Atlas cluster. See Seed with mongorestore in the Atlas documentation.

Regards,
Stennie

1 Like

Thank you for engaging with me.

I read through the official migration process and started to do it but then realized that I can’t migrate in to an existing cluster and if I make a second cluster I will be charged double. I believe I can have multiple DB in the same cluster. I am a public school HS Computer Science teacher. MongoDB was generous to give me a $300 credit and I need to milk it. I have one DB in Atlas in an M2 cluster ($9/mo) that is running great! I have one other app I want to move over from a free tier in mLab to that same cluster in MongoDB. It seems the official process with wipe out my existing cluster. So, I need to use the mongodump and mongorestore process?

Hi Stephen,

The “mongodump” and “mongorestore” method as suggested by Stennie will work fine!

Kind regards,
Leo

1 Like

Hi @Stephen_Wright,

Were you able to migrate your mLab Sandbox data across to Atlas?

A single MongoDB deployment can have multiple databases. Shared tier Atlas deployments (M0, M2, and M5) currently allow up to 100 databases and 500 collections in total. See: Atlas M0 (Free Tier), M2, and M5 Limitations. Dedicated clusters (M10+) do not have limits on the number of databases or collections.

Depending on how you want to combine data from your backup into your destination Atlas cluster, there are several approaches to consider. The mongorestore documentation includes a full list of options, but here are some common starting points:

  • No collection conflicts

    If collections you are restoring do not already exist on your target Atlas cluster, you can mongorestore your backup as-is. New databases and collections will be created alongside any existing ones in the deployment.

  • Replacing existing collections with the backup version:

    If collections you are restoring exist on your target Atlas cluster and you want to replace the existing data, use the --drop option to drop existing collections that are also in the backup. This option does not drop collections that aren’t in the backup.

  • Rename collections while restoring to avoid conflicts

    If collections you are restoring exist on your target Atlas cluster and you want to preserve the existing data, use the --nsFrom and --nsTo options to Change Collections’ Namespaces during Restore.

If you have any further questions, please provide more detail on what you are trying to achieve so we can suggest an approach.

Regards,
Stennie