I'm trying to use the mongoose
to try to fetch all the records under the Profile Schema using the find()
method. The code looks fine to me and when I console.log
the code block, it returns Promise { <pending> }
.
I tried different approaches with no hope. Any help would be appreciated. Thanks,
Here is my Code:
return Profile.find()
.then(profiles => {
return profiles.map(profile =>{
return {
...profile._doc
};
});
}).catch(err => {
//console.log(err);
throw err;
})