Last active
August 18, 2017 03:58
-
-
Save cookie-ag/44a9a02bcbbc6fa64dae98f78feb48ff to your computer and use it in GitHub Desktop.
Backup/Restore from MongoDB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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