How do you import and export data in a secured mongodb for backup?
meda Changed status to publish 16/07/2022
To export or dump data out of secure mongo database. Issue this command:
- mongodump -u username -p ‘password’ –authenticationDatabase admindatabasename -d databasename(your specific database) -o ./db
To import or restore all dumped data you can issue this command.
- mongorestore -u username -p ‘password’ -d [dbname] [directory-backup]
the_reactor Answered question 18/02/2022