https://github.com/codetronicsio/mongoclean-cli
A simple NodeJS CLI to clean a MongoDB
https://github.com/codetronicsio/mongoclean-cli
mongodb nodejs npm testing
Last synced: about 2 months ago
JSON representation
A simple NodeJS CLI to clean a MongoDB
- Host: GitHub
- URL: https://github.com/codetronicsio/mongoclean-cli
- Owner: codetronicsio
- License: mit
- Created: 2017-06-02T15:40:39.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-06-05T19:18:20.000Z (about 9 years ago)
- Last Synced: 2025-09-21T21:34:09.116Z (10 months ago)
- Topics: mongodb, nodejs, npm, testing
- Language: JavaScript
- Homepage:
- Size: 27.3 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
mongoclean-cli
==============
[](https://nodei.co/npm/mongoclean-cli/)
[](https://badge.fury.io/js/mongoclean-cli) [](https://travis-ci.org/codetronicsio/mongoclean-cli) [](https://codeclimate.com/github/codetronicsio/mongoclean-cli) [](https://coveralls.io/github/codetronicsio/mongoclean-cli)
Clean all the collections in a mongo database thru the CLI.
This is actually a simple wrapper for the excelent [mongo-clean](https://github.com/mcollina/mongo-clean)
## Install
```bash
$ npm install mongoclean-cli --save-dev
```
## Usage
```bash
$ mongoclean-cli -h
Usage:
mongoclean-cli [OPTIONS] [ARGS]
Options:
-m, --mongo [STRING] The full connection string to the mongoDB || MONGO env (Default is mongodb://localhost:27017/test)
-u, --url [STRING] The URL for the mongoDB || MONGO_HOST env (Default is mongodb://localhost)
-p, --port [NUMBER] The PORT for the mongoDB || MONGO_PORT env (Default is 27017)
-d, --db [STRING] The name for the DB || MONGO_NAME env (Default is test)
-h, --help Display help and usage details
```
It uses *dotenv*, so be careful if you have a *.env* file in your current working directory (_${PWD}_)
A simple way to use it is to call it in your test script before running the actual test tool.
```json
"scripts": {
"test": "cp .env.test .env && mongoclean-cli && mocha"
},
```
or
```json
"scripts": {
"test": "mongoclean-cli -h mongodb://my-mongodb-host -p 1234 -d testdb && mocha"
},
```
## License
MIT
### PR && Issues
... are welcome