3.0.1 • Published 8 years ago

mobgoose v3.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

mobgoose

Circle CI

mobgoose will reuse connections to the same url and useDb(database) for you. If you are using database-per-tenant multi-tenancy this saves on open connections to the server.

Usage

You need to have mongoose as a dependency.

var mongoose = require('mongoose'),
var mobgoose = require('mobgoose')(mongoose);

// connect via string
mobgoose('mongodb://localhost:27017/my_db');

// connect via options
mobgoose({
  host: 'localhost',
  database: 'my_other_db'
});

These two calls result in a single actual connection to localhost:27017 and each call returns a promise, which is resolved with a 'virtual' connection to my_db and my_other_db respectively.

So you can .then(function(connection) { /* .. */ }) and don't forget, you need to use connection.model(modelName) to get a model that makes use of said connection, you can't just use a model via require -- that uses the global connection (never established here).

3.0.1

8 years ago

3.0.0

8 years ago

2.1.0

9 years ago

2.0.0

9 years ago

1.4.0

9 years ago

1.3.0

9 years ago

1.2.0

9 years ago

1.1.0

9 years ago

1.0.0

9 years ago