Los resultados del bucle nested del nodo js finalmente empujan a un solo arreglo

obtendré la matriz de respuestas

pero cómo obtener la información de los usuarios respondidos;

el flujo es Obtener Lista de Publicaciones , Publicar Información de Usuario , Contabilizar Seguidores de Usuarios , Publicar Cuenta de Me Gusta , Iniciar Sesión de Usuario Me gustó La Publicación Verdadera o Falsa , Respuestas , Información de Usuario Contestada y Cuenta de Seguidores de Usuarios Contestados

exports.GetPostList = function(req, res) { var SkipCoun = 0; SkipCoun = parseInt(req.params.Limit) * 10; QuestionsPostModel.QuestionsPostType.find({}, {} , {sort:{createdAt : -1}, skip: SkipCoun, limit: 10 }, function(err, result) { if(err) { res.status(500).send({status:"False", message: "Some error occurred while Find Following Users ."}); } else { const GetUserData = (result) => Promise.all( result.map(info => getPostInfo(info)) ).then( results => { let [UserInfo, UserFollowers, PostRatingCount, UserRatedCount, AnswersCount, AswersArray ] = results.reduce(([allOne, allTwo, allThree, allFour, allFive, allSix ], [one, two, three, four, five, six]) => [allOne.concat([one]), allTwo.concat([two]), allThree.concat([three]), allFour.concat([four]), allFive.concat([five]), allSix.concat([six])], [ [], [], [], [], [], [] ]); res.send({ status: "True", UserInfo: UserInfo, UserFollowers: UserFollowers, PostRatingCount: PostRatingCount, UserRatedCount: UserRatedCount, AnswersCount:AnswersCount, AswersArray:AswersArray }) } ).catch(err => res.send({ status: "Fale",Error: err}) ); const getPostInfo = info => Promise.all([ UserModel.UserType.findOne({'_id': info.UserId }, usersProjection).exec(), FollowModel.FollowUserType.count({'UserId': info.UserId}).exec(), RatingModel.QuestionsRating.count({'PostId': info._id , 'ActiveStates':'Active' }).exec(), RatingModel.QuestionsRating.count({'UserId': req.params.UserId, 'PostId': info._id, 'PostUserId': info.UserId, 'ActiveStates':'Active'}).exec(), AnswerModel.QuestionsAnwer.count({'PostId': info._id , 'ActiveStates':'Active' }).exec(), AnswerModel.QuestionsAnwer.find({ 'PostId':info._id }, 'AnswerText UserId Date' ).exec() ]); GetUserData(result); } }); }; 

Cómo obtener el resultado

a medida que formó la matriz, y la está pasando dentro de Promise.all() . y solo necesitas los datos.

Promise.all() docs .

ver el Código Abajo (podemos hacer lo que prometemos .then() y .catch() ):

 exports.GetPostList = function (req, res) { var SkipCoun = 0; SkipCoun = parseInt(req.params.Limit) * 10; QuestionsPostModel.QuestionsPostType.find({}, {}, { sort: { createdAt: -1 }, skip: SkipCoun, limit: 10 }, function (err, result) { if (err) { res.status(500).send({ status: "False", message: "Some error occurred while Find Following Users ." }); } else { const GetUserData = (result) => Promise.all( result.map(info => getPostInfo(info)) ).then( results => { let [UserInfo, UserFollowers, PostRatingCount, UserRatedCount, AnswersCount, AswersArray] = results.reduce(([allOne, allTwo, allThree, allFour, allFive, allSix], [one, two, three, four, five, six]) => [allOne.concat([one]), allTwo.concat([two]), allThree.concat([three]), allFour.concat([four]), allFive.concat([five]), allSix.concat([six])], [[], [], [], [], [], []]); res.send({ status: "True", UserInfo: UserInfo, UserFollowers: UserFollowers, PostRatingCount: PostRatingCount, UserRatedCount: UserRatedCount, AnswersCount: AnswersCount, AswersArray: AswersArray }) } ).catch(err => res.send({ status: "Fale", Error: err })); const getPostInfo = info => Promise.all([ UserModel.UserType.findOne({ '_id': info.UserId }, usersProjection).exec(), FollowModel.FollowUserType.count({ 'UserId': info.UserId }).exec(), RatingModel.QuestionsRating.count({ 'PostId': info._id, 'ActiveStates': 'Active' }).exec(), RatingModel.QuestionsRating.count({ 'UserId': req.params.UserId, 'PostId': info._id, 'PostUserId': info.UserId, 'ActiveStates': 'Active' }).exec(), AnswerModel.QuestionsAnwer.count({ 'PostId': info._id, 'ActiveStates': 'Active' }).exec(), AnswerModel.QuestionsAnwer.find({ 'PostId': info._id }, 'AnswerText UserId Date').exec() ]).then(data => { let userData = data[0]; let followCount = data[1]; let ratingCount = data[2]; let ratingCountBy_postId = data[3]; let answerCount = data[4]; let answers = data[5]; // now you may need to construct some object or something and pass data as you required. let result = { user: userData, follow_count: followCount, rating_count: ratingCount, rating_countBy_postId: ratingCountBy_postId, answer_count: answerCount, answers: answers }; }).catch(error => { console.log(error) }) GetUserData(result); } }); }; 
 exports.GetPostList = function (req, res) { var SkipCoun = 0; SkipCoun = parseInt(req.params.Limit) * 10; QuestionsPostModel.QuestionsPostType.find({}, {}, { sort: { createdAt: -1 }, skip: SkipCoun, limit: 10 }, function (err, result) { if (err) { res.status(500).send({ status: "False", message: "Some error occurred while Find Following Users ." }); } else { const GetUserData = (result) => Promise.all( result.map(info => getPostInfo(info)) ).then( result =>{ console.log(result); res.send({ status: "True", data: result }) } ).catch(err => res.send({ status: "False", Error: err })); const getPostInfo = info => Promise.all([ UserModel.UserType.findOne({ '_id': info.UserId }, usersProjection).exec(), FollowModel.FollowUserType.count({ 'UserId': info.UserId }).exec(), RatingModel.QuestionsRating.count({ 'PostId': info._id, 'ActiveStates': 'Active' }).exec(), RatingModel.QuestionsRating.count({ 'UserId': req.params.UserId, 'PostId': info._id, 'PostUserId': info.UserId, 'ActiveStates': 'Active' }).exec(), AnswerModel.QuestionsAnwer.count({ 'PostId': info._id, 'ActiveStates': 'Active' }).exec(), AnswerModel.QuestionsAnwer.find({ 'PostId': info._id }, 'AnswerText UserId Date').exec() ]).then(data => { let UserData = data[0]; let followCount = data[1]; let ratingCount = data[2]; let UserRating = data[3]; let AnswerCount = data[4]; let Answerdata = data[5]; var AnswersArray= new Array(); return GetAnsUserData(); async function GetAnsUserData(){ for (let ansInfo of Answerdata) { await getAnswerInfo(ansInfo); } let result = { _id: info._id, UserId: UserData._id, UserName: UserData.UserName, UserCategoryId: UserData.UserCategoryId, UserCategoryName: UserData.UserCategoryName, UserImage: UserData.UserImage, UserCompany: UserData.UserCompany, UserProfession: UserData.UserProfession, Followers:followCount, PostTopicId: info.PostTopicId, PostTopicName: info.PostTopicName, PostDate: info.PostDate, PostText: info.PostText , PostLink: info.PostLink, PostImage: info.PostImage, PostVideo: info.PostVideo, RatingCount: ratingCount, UserRating: UserRating, AnswersCount: AnswerCount, Answers: AnswersArray, }; return result; } function getAnswerInfo(ansInfo){ return new Promise(( resolve, reject )=>{ UserModel.UserType.findOne({'_id': ansInfo.UserId }, usersProjection, function(err, AnsUserData) { if(err) { res.send({status:"Fale", Error:err }); reject(err); } else { FollowModel.FollowUserType.count({'UserId': AnsUserData._id}, function(newerr, count) { if(newerr){ res.send({status:"Fale", Error:newerr }); reject(newerr); }else{ var newArray = []; newArray.push( { _id: ansInfo._id, UserId: AnsUserData._id, UserName: AnsUserData.UserName, UserCategoryId: AnsUserData.UserCategoryId, UserCategoryName: AnsUserData.UserCategoryName, UserImage: AnsUserData.UserImage, UserCompany: AnsUserData.UserCompany, UserProfession: AnsUserData.UserProfession, Followers: count, Date: ansInfo.Date, PostId: ansInfo.PostId, PostUserId: ansInfo.PostUserId , AnswerText: ansInfo.AnswerText } ); AnswersArray.push(newArray[0]); resolve(newArray[0]); } }); } }); }); } }).catch(error => { console.log(error) }) GetUserData(result); } }); }; 

Finalmente recibo la respuesta gracias a todos.