This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

mongoware

1.0.0 • Public • Published

mongoware

npm npm

A simple MongoDB middleware

Installation

Use NPM for install mongoware on your project:

npm install mongoware

Usage

First, you must import mongoware on your project:

//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:

//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.

Package Sidebar

Install

npm i mongoware

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • jmjuanes