How to export mongodb database / all collections of the database ?

How-export- mongodb- database-collections- database-featured

MongoDB Database Export / Import (All collections export / import)

How-export- mongodb- database-collections- database-blog

MongoDB Export Command to export all the collections of the database:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
mongodump -d <database_name> -o <directory_backup>
mongodump -d <database_name> -o <directory_backup>
mongodump -d <database_name> -o <directory_backup>

Example:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
mongodump -d ngdeveloper -0 D:\ngdeveloper\mongodb-exports\
mongodump -d ngdeveloper -0 D:\ngdeveloper\mongodb-exports\
mongodump -d ngdeveloper -0 D:\ngdeveloper\mongodb-exports\

MongoDB Import Command to import all the collections of the database:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
mongorestore -d <database_name> <directory_backup>
mongorestore -d <database_name> <directory_backup>
mongorestore -d <database_name> <directory_backup>

Example:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
mongorestore -d ngdeveloper D:\ngdeveloper\mongodb-exports\
mongorestore -d ngdeveloper D:\ngdeveloper\mongodb-exports\
mongorestore -d ngdeveloper D:\ngdeveloper\mongodb-exports\

Leave a Reply