0.0.6 • Published 5 years ago

rongo v0.0.6

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

Rongo

https://github.com/ristika/rongo

https://www.npmjs.com/package/rongo

A simple wrapper with limited (but most of what you might need) for the official MongoDB Node.js driver

Ideal for replica sets and allowing the client to manage and persist connections rather than creating one on each call.

For information on using the mongo with express see: https://www.ristika.com/search?keyword=express;mongo.

To use:


  • Import the package via npm - var rongo = require('rongo');

  • Set your global DBAddresses object:

global.DBAddresses = {
	read: 'localhost:27017/' + dbName,
	write: 'localhost:27017/' + dbName
};

or

global.DBAddresses = {
	read: 'replica0:27017/' + dbName,
	write: 'replica1:27017/' + dbName
};
  • Call rongo.setUpDBs('dbname');

  • Rongo can now be passed around and used in places like:

rongo.collection('acoll').find({ name: name }, (err, docs) => callbackFunc);

To do:


  • Return promises rather than using callbacks

  • Add a util function to determine a write address

  • Manage state within rongo, updating the dbs etc

  • Add linting

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago