Skip to content

Instantly share code, notes, and snippets.

@joepie91
Forked from vicatcu/take2.js
Last active January 13, 2016 00:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joepie91/84b93278a8942dab6e61 to your computer and use it in GitHub Desktop.
Save joepie91/84b93278a8942dab6e61 to your computer and use it in GitHub Desktop.
return Promise.try(function () {
return MongoClient.connectAsync(MONGODB_CONNECTION_STRING)
}).then(function(db){
return Promise.try(function(){
return db.collection("downloads").findOneAsync({key: status.filename});
}).then(function(item){
return Promise.try(function() {
return db.closeAsync();
}).then(function() {
return item;
});
});
}).then(function(content) {
// ...
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment