Skip to content

Instantly share code, notes, and snippets.

@reggi
Last active August 29, 2015 14:01
Show Gist options
  • Save reggi/4ed1d63b12db2456633a to your computer and use it in GitHub Desktop.
Save reggi/4ed1d63b12db2456633a to your computer and use it in GitHub Desktop.
mongoConnect(mongoUrl)
.then(function(db) {
var flow = {};
flow.db = db;
return flow;
})
.then(function(flow) {
console.log("hello world");
return flow;
})
.then(function(flow) {
flow.db.close();
});
mongoConnect(mongoUrl)
.then(function(db) {
var customers = db.collection("customers");
return Q.denodeify(customers.find().toArray);
})
.then(function(customers) {
console.log(customers.length);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment