1.0.2 • Published 3 years ago

erfan-mongo-json-backup v1.0.2

Weekly downloads
-
License
Apache License 2....
Repository
github
Last release
3 years ago

Nodejs: erfan-mongo-json-backup

📖 Getting started

$ npm i erfan-mongo-json-backup

This package use mongoose and mongoexport command for backup.

Process

This package creates a folder with name like <DATABSE_NAME>-<CURRENT_DATE_STRING> and stores all collections in .json files with their name inside the folder.

💻 Usage

  const mongoBackup = require('erfan-mongo-json-backup');

  const connectionString = "<DATABASE_CONNECTION_STRING>";
  const dbOptions = {
    user: "<USERNAME>",
    pass: "<PASSWORD>",
    host: "<HOST>",
    port: 27017,
    database: "<DATABSE_NAME>",
    removeDayBeforeBackup: true,
  };

  mongoBackup(connectionString, dbOptions);

💡 Props

PropTypeExampleNote
userstringadminDatabase Username.
passstring12345678Database Password.
hoststringlocalhostDatabase Host.
portnumber27017Database Port.
databasestringadminDatabase Name.
removeDayBeforeBackupbooleantrueRemoves the day befores backup folder.

📜 License

This library is provided under the Apache License.