0.4.4 • Published 12 months ago

mongoose-partial-dumper v0.4.4

Weekly downloads
-
License
ISC
Repository
github
Last release
12 months ago

Mongoose Partial Dump

A partial dumper helper for a mongoose environment.

This package will aid developers to create partial dumps of a mongoDB database using mongoose. Making possible to easily dump only documents related to specifics functionalities of a bigger project.

Table of Contents

Installation

  • npm install -g mongoose-partial-dumper
  • npm install mongoose-partial-dumper
  • yarn add mongoose-partial-dump

DUMPER

Responsible for write dump files or log dump json

Usage

  • Create a partial-dump.config.{ts, js} file
  • yarn partial dump <collectionName> [id] [outputDir]

Strategies

Default

Default strategy

Config

Install:type:Description:Required:example:
dbobjectdatabase input configurationstrue{url: ''}
db.urlstringdatabase url configurationstruemongodb://localhost:27017/dumper-example
modelsModel[]Mongoose Model listtrue{models: User}
getPayloadfunctionFunction that returns a Model.find() Objectfalse{_id: , company: }
outputDirstringdatabase input configurationsfalse'dump.json'
anonymizeobjectanonymize info object, data anonymizationfalse{field: 'name', type: 'name'}
anonymize.fieldstringinput to dumper know which fields to anonymizefalse'name', 'phone', 'address', etc...
anonymize.typeenuminput to dumper know which type the field isfalse'name', 'phone', 'address', etc...

Anonymize Type Enum

  • name
  • phone
  • address
  • avatar
  • birthdate
  • creationDate
  • companyName

CLI

Arguments
Input:type:Description:Required:example:
collectionNamestringMain collection name to be base of your dumptrue'User'
idstringIf given, dump will priorize this input to return all documents relatedfalse'60b40699c73c9095df00c22b'
outputDirstringPath to file to be created or overwritenfalse'dump.json'
Options
Input:type:Description:Required:example:
--logstringIf this option is given, no file will be generated, instead a log will show on consolefalse'User'

RESTORE

Responsible for read dump files and import to your database

Usage

  • Create a partial-dump.config.{ts, js} file
  • yarn partial restore [inputDir]

Config

Install:type:Description:Required:example:
dbobjectdatabase input configurationstrue{url: ''}
db.urlstringdatabase url configurationstruemongodb://localhost:27017/dumper-example
modelsModel[]Mongoose Model listtrue{models: User}
inputDirstringPath to file to be restored (imported to your database)false'dump.json'

CLI

Arguments
Input:type:Description:Required:example:
inputDirstringPath to file to be restored (imported to your database)false'dump.json'

Examples

0.4.4

12 months ago

0.4.3

2 years ago

0.4.2

2 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.3.2

3 years ago

0.3.1

3 years ago

0.2.0

3 years ago

0.1.0

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.0.27

3 years ago

0.0.28

3 years ago

0.0.26

3 years ago

0.0.25

3 years ago

0.0.24

3 years ago

0.0.23

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago

1.0.0

3 years ago