I have a list of profile IDs that looks like
get profiles [ '62d80ece61a85d738fa0c297', '62d80fb061a85d738fa0c29c' ]
I am trying to iterate through this list and use each ID in the find() method
Here is my code snippet:
let total = [];
profile.forEach(async (index) => {
console.log('index', index);
//Output from the console for index
//index 62d80ece61a85d738fa0c297
//index 62d80fb061a85d738fa0c29c
let user = await this.userModel.findOne({ _id: index });
total.push(user);
console.log('Service', total);
//The output from Service is []
Thank you in advance