I am trying to use Typescript with Express and Mongoose. So far the result has been amazing. I am however stuck at a very minor part.
Premise: I am executing a Mongoose Query using EXEC()
let result = await UserModel.User.find().exec();
I have to use the async / await as there is some processing after this line and I want to avoid callbacks throughout
Problem
I need to get the {err, data} from the result object returned by the query. However currently it simply holds the entire data and I am not able to perform the error handling
So need a way to get the mongoose error description when I use async/await