How to export data from mongodb using robomongo?


How to export the MongoDB database using Robo 3t?

Need to run cmd as an administrator (window + R then type cmd  then enter) after then go to the program file where install MongoDB follow with this path:

C:\Program Files\MongoDB\Server\4.2\bin

And go to this directory with cd C:\Program Files\MongoDB\Server\4.2\bin

And then use this syntax, you can export only collection or the table:

mongoexport --db dbName --collection collectionName --out outputFileName.json
                                               
mongoexport --db abc --collection xyz --out xyz.json

Also, you can see below screenshot.

And if you want to get complete db then use this command 

C:\Program Files\MongoDB\Server\4.2\bin>mongodump -h localhost -d databaseName -o "f:\backupFolderName"

With user name and password
C:\Program Files\MongoDB\Server\4.2\bin>mongodump -h databaseHost -d databaseName -u username -p password -o "f:\ backupFolderName "

No comments:

Note: Only a member of this blog may post a comment.

Copyright Reserved to Anything Learn. Powered by Blogger.