mi

mongodb-instance

Downloads and installs mongodb relative to the package, intended for testing purposes.

Showing:

Popularity

Downloads/wk

10

GitHub Stars

0

Maintenance

Last Commit

5yrs ago

Contributors

0

Package

Dependencies

1

Size (min+gzip)

0.4KB

License

AGPL-3.0-or-later

Type Definitions

Tree-Shakeable

No?

Categories

Deprecated!
This package is unmaintained

Readme

mongodb-instance

Downloads and installs mongodb relative to the package, intended for testing purposes.

installation

npm install mongodb-instance

Example

'use strict';

var mongod = require('mongodb-instance'),
    path   = require('path'),
    MongoClient = require('mongodb').MongoClient;

var port = 27000;
var instance = mongod.start({
  port: port,
  dbpath: path.join(__dirname, 'db')
});

setTimeout(function () {
  MongoClient.connect('mongodb://localhost:' + port, function (err, db) {
    if (err) {
      console.error(err);
    } else {
      console.log('Connected to db: ' + db.databaseName);
      db.close();
    }
    
    setTimeout(instance.stop.bind(instance), 1000);
  });
}, 1000);

Known issues

  • Only tested on a mac
  • Suffers from racing conditions when starting up (use setTimeout for now)
  • Do not install globally (-g)

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100