await mongoose.connect code example
Example 1: async await mongoose connection
(async () => {
try {
await mongoose.connect(dbURI, dbOptions)
} catch (err) {
console.log('error: ' + err)
}
})()
Example 2: mongoose.connect
mongoose.connect('mongodb://localhost:27017/myapp', {useNewUrlParser: true});