promised-mongo
promised-mongo copied to clipboard
Invalid connection crashes the process
When trying to connect to a non-existent instance of MongoDB, it simply crashes. Consider this code:
(async function() {
try {
console.log('run')
let db = await require('promised-mongo')('localhost')
let test = db.collection('test')
await test.insert({test: 1})
console.log('done')
}
catch (err) {
console.log('error')
}
})()
When I run this without starting mongod
first, it doesn't show error
, it simply crashes. Is this to be expected?