# mongoware

> A simple MongoDB middleware

Latest version **1.0.0** (published 2016-05-06) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

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

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2016-05-06 |
| First published | 2016-05-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Josemi Juanes |
| Maintainers | jmjuanes |
| Keywords | mongo, mongodb, middleware |

## Links

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

## Dependencies (1)

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

## 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

- 1.0.0 (latest) — 2016-05-06

## README

# mongoware

[![npm](https://img.shields.io/npm/v/mongoware.svg?style=flat-square)](https://www.npmjs.com/package/mongoware)
[![npm](https://img.shields.io/npm/dt/mongoware.svg?style=flat-square)](https://www.npmjs.com/package/mongoware)

A simple MongoDB middleware

## Installation

Use [NPM](https://npmjs.com) for install **mongoware** on your project:

```
npm install mongoware
```

## Usage

First, you must import **mongoware** on your project:

```javascript
//Import mongoware
var db = require('mongoware');
```

### db.Connect(options, callback)

Use the `Connect` method to connect to a MongoDB database. You must provide an object with the following elements:

- `user`: username of the mongodb database.
- `pass`: password of the mongodb database.
- `host`: mongodb host. For local hosts, use `localhost`.
- `port`: mongodb port.
- `db`: database name.
- `auth` (optionally): authentication database name.

The `callback` argument is a function that returns an error if something wrong occurs. If all is ok, it will return `null`.

Example of use:

```javascript
//Connect to the database
db.Connect({ user: 'my-user', pass: 'my-pass', host: 'localhost', port: 27017, db: 'testdb' }, function(err){

	//Check for an error
	if(err)
	{
		//Something wrong occurs
	}

	//All done, continue!

});
```

### db.Get()

Return the database.

### db.GetCollection(c)

Return a collection.

### db.Close(callback)

Close the connection to the database.


## License

Under the [MIT LICENSE](LICENSE).

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