Q: I am exporting MongoDB data as BSON with Studio 3T. Should I export the MongoDB data as a folder or archive? I’m not sure what the choice practically means.
A: Are you making a back up of your database, specifically to restore all of it in the future? If you are and only ever expect to restore all the data of it, then archive is your best choice.
An archive is a single compressed file with a .agz
extension, created by the mongodump command. It’s easy to spot and pretty easy to manage with it being a single file. If you need to pull out one collection or database, Studio 3T gives you the ability to enter their names when importing. But that’s about as far as you can go.
However, if you are exporting to import parts of your database into another server or restructuring your existing server, we recommend the folder format. This creates folders for every database and within those folders, more folders for every collection. The arrangement makes it possible for tools such as Studio 3T to locate collections without unpacking the entire archive. Unpacking the archive is something that could be quite machine consuming and messy.
In Studio 3T, you can browse the entire tree of databases and collections. Then you can select which ones you want to restore when restoring an BSON export in folder format. That makes the format ideal for when you want to move selected parts of a database between two servers. It’s also useful if you regularly find yourself doing partial restores.
Exporting to BSON is one of the many export options in Studio 3T.
Do you need to be Exporting MongoDB as BSON?
A lot of exporting of MongoDB data as BSON is done to copy and clone collections. This is because MongoDB doesn’t have an easy copy option. But Studio 3T does.
Need to clone a collection with Studio 3T? Literally just copy and paste it and you’ll be prompted for a new name for your clone. It’s that easy.
If you are regularly moving collections between servers, why not use Studio 3T’s ability to copy data between servers. There’s Import “from a collection” which can pull a collection’s data from one server to another. It also gives you control on how the existing data in the collection on the destination server is handled. You can also save and schedule that operation as a repeatable Task.
For more ad-hoc updates, don’t forget that Studio 3T brings copy and paste to the connection tree. You can copy a collection on one server and paste it into place on another. And you can do that with databases too.
If what you really want is the ability to synchronize two database collections, check out Compare in the global toolbar. Also known as Compare & Sync, this works on collections on one or more servers. It lets you do a data and schema comparative deep dive for you. You are then presented with the differences (graphically). You can then resync the data document by document or in bulk.