How can I use mongoose promises with the vscode code runner extension. Consider the code below.
async function getUsers(){
return await User.find({}).exec()
}
console.log(getUsers()) //returns Promise { <pending> }
Why is it returning a promise? Yet I have used async/await? Plus according to the mongoose docs using exec()
makes a query a promise. How can I get the resolved promise?