I cannot understand for life why this does not end:
var pmongo = require('promised-mongo');
var db = pmongo('mongodb://localhost/builder');
var block_id = '538d097bbb12479d0e9f70ab';
var collection = db.collection('block');
collection.findOne({_id:db.ObjectId(block_id)})
.then(function(result) {
console.dir(result);
}).done();
It just freezes. findOne returns the promise I'm calling. Oddly enough, when I close the database (i.e. Db.close ()) at that, it ends.
I try to end up doing this with express, so I really don't want to close the database. What trick ????
source
share