# moongo

> mongo queries automation tool

Latest version **0.2.1** (published 2016-03-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install moongo
pnpm add moongo
yarn add moongo
bun add moongo
```

Provides the command `moongo`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2016-03-29 |
| First published | 2016-03-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Known vulnerabilities | 0 (+4 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | rumkin |
| Maintainers | rumkin |
| Keywords | mongo, automation, cli-util |

## Links

- npm: https://www.npmjs.com/package/moongo
- Repository: https://github.com/rumkin/moongo
- Homepage: https://github.com/rumkin/moongo#readme
- Issues: https://github.com/rumkin/moongo/issues
- npm.io page: https://npm.io/package/moongo

## Dependencies (7)

- [fn-args](https://npm.io/package/fn-args.md) ^1.0.0
- [mongodb](https://npm.io/package/mongodb.md) ^2.1.11
- [argentum](https://npm.io/package/argentum.md) ^0.4.0
- [camelcase](https://npm.io/package/camelcase.md) ^2.1.1
- [node-proxy](https://npm.io/package/node-proxy.md) ^1.0.0
- [object-path](https://npm.io/package/object-path.md) ^0.9.2
- [prompt-sync](https://npm.io/package/prompt-sync.md) ^4.0.4

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [mongoose-typescript](https://npm.io/package/mongoose-typescript.md) — 85 weekly downloads

## Recent versions

- 0.2.1 (latest) — 2016-03-29
- 0.2.0 — 2016-03-29
- 0.1.0 — 2016-03-25

## README

# Moongo

Moongo is a mongo queries automation tool. All you should to do is create
some scripts and create config file.

## Installation

```shell
npm i moongo -g
```

## Example

Create script `moongo/update-counters.js`:

```javascript
// moongo/update-counters.js
module.exports = function($api, type, inc, dec) {
    var col = $api.collection('counters');

    if (inc !== 'undefined') {
        return col.update({
            type
        }, {
            $inc: inc
        });
    }
    else if (dec !== 'undefined') {
        return col.update({
            type
        }, {
            $inc: dec
        });
    }
    else {
        throw new Error('No inc or dec param specified');
    }
};
```

Run script:

```bash
$ cd moongo
$ moongo run local update-counters.js type=active inc=1 # -> ok
$ moongo run local update-counters.js type=inactive dec=1 # -> ok
$ moongo run local update-counters.js type=inactive # -> No inc or dec param specified
```

## Config

Configuration file should contain connections:

```javascript
{
    "connections": {
        "local": {
            "host": "localhost",
            "port": 27017,
            "base": "my-base",
            "confirm": false
        }
    }
}
```

### Connection options

| Option  | Type     | Desc                                           |
|:--------|:---------|:-----------------------------------------------|
| host    | `string` | MongoDB host                                   |
| port    | `number` | MongoDB port                                   |
| base    | `string` | Database name                                  |
| confirm | `bool`   | Force confirmation prompt to prevent accidents |

---
_Source: https://npm.io/package/moongo · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
