Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Example of MongoDb singleton connection
var mongoDbConnection = require('./lib/connection.js');
exports.index = function(req, res, next) {
mongoDbConnection(function(databaseConnection) {
databaseConnection.collection('collectionName', function(error, collection) {
collection.find().toArray(function(error, results) {
//blah blah
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment