Skip to content

Instantly share code, notes, and snippets.

@cookie-ag
Last active August 18, 2017 03:58
Show Gist options
  • Save cookie-ag/44a9a02bcbbc6fa64dae98f78feb48ff to your computer and use it in GitHub Desktop.
Save cookie-ag/44a9a02bcbbc6fa64dae98f78feb48ff to your computer and use it in GitHub Desktop.
Backup/Restore from MongoDB
//npm i -g grunt-cli
//npm i grunt grunt-mongo-backup
//tested on 0.0.2
'use strict';
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-mongo-backup');
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
mongobackup: {
options: {
host: 'IP',
port: 'PORT',
db: 'NAME',
dump: {
out: './backups/db/',
},
restore: {
path: './backups/db/folder',
drop: true
}
}
}
});
grunt.registerTask('backup', ['mongobackup:dump']);
grunt.registerTask('restore', ['mongobackup:restore']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment