# basicmongo

> Easy way to use mongodb.

Latest version **2.0.3** (published 2018-01-23) · ISC license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.3 |
| Published | 2018-01-23 |
| First published | 2018-01-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Maplemx |
| Maintainers | maplemx |
| Keywords | mongodb, mxmongo, basicmongo |

## Links

- npm: https://www.npmjs.com/package/basicmongo
- npm.io page: https://npm.io/package/basicmongo

## Dependencies (1)

- [mongodb](https://npm.io/package/mongodb.md) ^2.2.5

## 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
- [@temporal-architect/claude-plugin](https://npm.io/package/@temporal-architect/claude-plugin.md) — 335 weekly downloads

## Recent versions

- 2.0.3 (latest) — 2018-01-23
- 2.0.2 — 2018-01-23
- 2.0.1 — 2018-01-23
- 2.0.0 — 2018-01-23

## README

# WHAT'S NICE ABOUT THIS MODULES?

1. Offer an easier way to access mongodb, no more callbacks after callbacks.
2. In each instance commands will be run by sequnce, you don't have to worry about those *"find" command run before "update" command situations* anymore.

# HOW TO USE?

## Quick Start

```
    const BasicMongo = require('basicmongo');
    const mongo = BasicMongo.create(
        '%YOUR HOST%',
        %YOUR PORT%,
        '%YOUR DATABASE%',
        %DEBUG OR NOT%);

    mongo
        .run( (db, resolve, reject) => {
            db.collection('test')
                .find({})
                .toArray(
                    (err, result) => {
                        console.log(result);
                        resolve(result);
                    }
                )
        } )
        .get( (result, resolve) => {
            console.log(result);
            resolve();
        } );
```

## Or You Can Use EasyMongo Methods

```
    mongo
        .collection('test')

        .find({})
        .get( (data, resolve) => {
            console.log(data);
            resolve();
        } )

        .insert({ title: 'test' })

        .find({})
        .get( (data, resolve) => {
            console.log(data);
            resolve();
        } )

        .remove({ title: 'test' })

        .find({})
        .get( (data, resolve) => {
            console.log(data);
            resolve();
        } );
```

## Method List

### Basic Methods

* run (runCommandFunc)
    * runCommandFunc (db, resolve, reject)
* get (getCommandFunc)
    * getCommandFunc (result, resolve, reject)

### EasyMongo Methods

* insert (docs, options)
* remove (selector, options)
* update (selector, doc, options)
    * default options = { upsert  : true, multi   : true }
* find (query, options) // You should use get method to get result.
* rename (newName, options)
* aggregate (pipeline, options) // You should use get method to get result.

# CONTACT ME

Email: [Maplemx@gmail.com](mailto:Maplemx@gmail.com)

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