1.0.6 • Published 3 years ago

@tiagoboeing/mongodb-database-exporter v1.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

MongoDB export database to file

npm (scoped) npm Snyk Vulnerabilities for npm package NPM

Export all collections from a MongoDB database and save on local file (.json).

Supported platforms

PlatformSupported
NodeJSYes
BrowserNo (created for terminal)

This use simple find({}) operations for each collection. Dangerous for large databases performance! Be careful!

Get started

NPM

Install:

npm i @tiagoboeing/mongodb-database-exporter --save-dev

Use in your JS/TS:

// ES6 syntax (recommended)
import mongoDBExporter from '@tiagoboeing/mongodb-database-exporter/dist/mongo-exporter'
mongoDBExporter.execute()

// ES5 syntax
const { mongoDBExporter } = require('@tiagoboeing/mongodb-database-exporter/dist/mongo-exporter')
mongoDBExporter.execute()

Running locally

.env file is the default strategy to resolve values. When you pass a configs on execute() this will be used.

As command line

Create a .env on project root. (Use .env.example as example).

Simple run:

npm install

npm start

You can make changes on src/index.ts to pass parameters without using DotEnv.

Available properties

SDK property.env propertyTypeDescriptionRequiredDefault
folderPathFOLDER_PATHstringChange default folder path to save files. Failed if folder not found!No%PROJECT_ROOT%/data
removeFileBeforeREMOVE_FILE_BEFOREbooleanRemove matches files on folder before save.Notrue
mongoConnection.hostnameHOSTNAMEstringMongoDB hostname to connect.YesN/A
mongoConnection.usernameUSERNAMEstringMongoDB username.YesN/A
mongoConnection.passwordPASSWORDstringMongoDB password.YesN/A
mongoConnection.databaseDATABASEstringMongoDB database to select.YesN/A
1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago