grunt-mongo-backup

0.0.2 • Public • Published

grunt-mongo-backup

Import and export data into mongodb using mongobackup. This grunt task is a simple wrapper around mongodump and mongorestore. It's a great way to configure your backups and share data.

Getting Started

This plugin requires Grunt `~0.4.5

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-mongo-backup --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-mongo-backup');

The mongobackup task

Overview

In your project's Gruntfile, add a section named mongoimport to the data object passed into grunt.initConfig().

grunt.initConfig({
  mongobackup: {
    options: {
      host : 'localhost',
      port: '27017',
      db : 'database-dev', 
      dump:{
        out : './dump',
      },    
      restore:{
        path : './dump/database-dev',          
        drop : true
      }
    }  
  }
});

Basic Usage

Mongodb Dump

grunt mongobackup:dump

Mongodb Restore

grunt mongobackup:restore

Options

Consult mongodb docs - mongodump and mongorestore for optional params.

NOTE: NOT ALL OPTIONS ARE AVAILABLE. Change to suit your needs.

Package Sidebar

Install

npm i grunt-mongo-backup

Weekly Downloads

71

Version

0.0.2

License

none

Last publish

Collaborators

  • seogrady