Mongodbexport does not export all collections

Hi,
i was just upgrading my mongodb version from 4.2 to 4.4 to explore some new features of mongoDB so i googled it and found the method but the first step was to take the backup of previous data so i did the same step and start exporting the collections but after few collections i notices that it’s only exporting 4 records of each collections. it doesn’t seems good to me.
Here are some screenshots of mongodbexport command.
By the way accounts collection have only ONE record and it exported FOUR, how?


image
only one record in accounts collection and 4 records in accountStandingInstructions

i exported all the collections and i saw some collections contain .BSON extension if it contain some jibrish type language, don’t know how this happens :disappointed_relieved: :disappointed_relieved:
I’m worried about this!

image

Hi @Nabeel_Raza,

First, your commands lines are not correct.

You are always downloading the same collection over and over again but in a different file each time.

Second, which version of mongoexport are you using? Did you also update it to 100.1.1?

Third, you got bson + metadata.json files because you used mongodump for these.

If you want to backup the entire database, the easiest solution is to use mongodump which by default will create a dump folder with all your databases and collections. mongorestore can then be used to restore these documents using this dump folder.

You can read more about these tools in the MongoDB documentation.

Cheers,
Maxime.

3 Likes

Thanks @MaBeuLux88 for you response which was helpful for me :v: :v:

1 Like