<commit_before># mongo-dumper
> Dump and restore single MongoDB instance and Replica set in Node.js

Mongo-dumper provides ground for writing Node.js code focused on dumping and restoring Mongo Databases. It is based on the concept of a Dumper, a vehicle designed for carrying bulk material. Considering that idea, we provide some kinds of Dumpers: 

- DatabaseToFileDumper
- FileToDatabaseDumper(TODO)
- DatabaseToDatabaseDumper(TODO)

In other words, load a Dumper with settings and call transport() to make it happen!

## Awesome features
* **single instance and replica set support** - make a hot backup on them
* **timestamp labeled backup files** - output files are saved with a moment.js timestamp reference
* **log files** - generate log files for each backup
* **compression** - tar.gz (Linux only)
* **authentication** - dump secure MongoDbs

## Usage
It's a piece of cake:
```bash
npm install mongo-dumper --save
```
```javascript
var Dumper = require('mongo-dumper').SomeDumper;

var settings = {
	hosts: 'localhost:27017,localhost:27018,localhost:27019',
	authentication : {
		database : 'admin',
		user : 'dbAdmin',
		password : '<PASSWORD>'
	}
};

var mongoDumper = new Dumper(settings);

mongoDumper.transport();
```

### Dumpers
Dumper objects contain one main function: transport. They receive a settings object when instanciated, each one validated accordingly to Dumper type object:

```javascript
function SomeDumper(dumperSettings) {
	// validate dumper settings
};

SomeDumper.prototype.transport = function(){
	// dump process
}
```

#### DatabaseToFileDumper
Makes a backup of datatbase into the filesystem. It is built as a wrapper of mongodump tool.

##### Dumper settings
```javascript
 var dumperSettings = {
 	"hosts" : "",
	"authentication" : {
		"user" : "",
		"password" : "",
		"database" : ""<commit_msg>Add info<commit_after># mongo-dumper
> Dump and restore single MongoDB instance and Replica set in Node.js

Mongo-dumper provides ground for writing Node.js code focused on dumping and restoring Mongo Databases. It is based on the concept of a Dumper, a vehicle designed for carrying bulk material. Considering that idea, we provide some kinds of Dumpers: 

- DatabaseToFileDumper
- FileToDatabaseDumper(TODO)
- DatabaseToDatabaseDumper(TODO)

In other words, load a Dumper with settings and call transport() to make it happen!

## Awesome features
* **single instance and replica set support** - make a hot backup on them
* **timestamp labeled backup files** - output files are saved with a moment.js timestamp reference
* **log files** - generate log files for each backup
* **compression** - tar.gz (Linux only)
* **authentication** - dump secure MongoDbs

## Usage
It's a piece of cake:
```bash
npm install mongo-dumper --save
```
```javascript
var Dumper = require('mongo-dumper').SomeDumper;

var settings = {
	hosts: 'localhost:27017,localhost:27018,localhost:27019',
	authentication : {
		database : 'admin',
		user : 'dbAdmin',
		password : '<PASSWORD>'
	}
};

var mongoDumper = new Dumper(settings);

mongoDumper.transport();
```

### Dumpers
Dumper objects contain one main function: transport. They receive a settings object when instanciated, each one validated accordingly to Dumper type object:

```javascript
function SomeDumper(dumperSettings) {
	// validate dumper settings
};

SomeDumper.prototype.transport = function(){
	// dump, restore or both
}
```

#### DatabaseToFileDumper
Makes a backup of datatbase into the filesystem. It is built as a wrapper of mongodump tool.

##### Dumper settings
```javascript
 var dumperSettings = {
 	"hosts" : "",
	"authentication" : {
		"user" : "",
		"password" : "",
		"database" : ""
{'fraction_non_alphanumeric': 0.10727865290602934, 'fraction_numerical': 0.008147745790331342, 'mean_word_length': 4.701238390092879, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1131541', 'n_tokens_mistral': 1127, 'n_tokens_neox': 1042, 'n_words': 413}