Skip to content

Instantly share code, notes, and snippets.

@chrisckchang
Last active December 25, 2015 13:29
Show Gist options
  • Save chrisckchang/6983995 to your computer and use it in GitHub Desktop.
Save chrisckchang/6983995 to your computer and use it in GitHub Desktop.
poolsize 5 example
var MongoClient = require('mongodb').MongoClient;
var URI = 'mongodb://localhost/test';
var options = { server : { poolSize : 5 } };
MongoClient.connect(URI, options,
function(err, db) {
//Create arbitrary long operation
db.eval('function (x) { while(x<10000000000){x++;} }',[0], { nolock: true }, function(err, result){
console.log("done slow");
});
db.collection('testing').findOne({ test: 1 }, function (err, doc){
console.log("done fast");
});
console.log("yo");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment