-
-
Save joepie91/84b93278a8942dab6e61 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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