export all collections mongodb code example
Example 1: mongodb export entire database
// EXPORT
mongodump -d <database_name> -o <directory_backup>
// IMPORT
mongorestore -d <database_name> <directory_backup>
Example 2: mongoexport whole database
mongodump --uri="mongodb://YOUR_USER_ID:YOUR_PASSWORD@YOUR_HOST_IP/YOUR_DB_NAME" --gzip --archive > YOUR_FILE_NAME