I am a new javascript user and I am looking for a rescuer the result (count) of a memory request.
More precisely, maybe you can comment, put my variable in my conv object
right now my result is [promised object] I tried with async and promised javascript but I do not understand the logic yet
Thank you so much,
Gabriel
                            var conversations = []
                            for (var i = 0; i < conversation.length; i++) {
                                for (var j = 0; j < conversation[i].users.length; j++) {
                                    conv = conversation[i].users[j]                 
                                    async function asyncCall() {
                                        function countUnread() {
                                            filterUnread = {$and:[
                                                {toID: user.properties.chat.id}, 
                                                {fromID: conversation[i].users[j].id},
                                                { read: false }]}
                                            return new Promise(resolve => {
                                                Message.countDocuments(filterUnread, function (err, count) {
                                                    resolve(count)
                                                })
                                            })
                                        }
                                        var count = await countUnread();
                                        console.log(count);
                                        console.log(conv)
                                        resolve(!!!!count!!!!) ;
                                    }
                                    asyncCall();
                                    conv.unread = !!!!I_want_my_count_here!!!!
                                    conversations.push(conv);
                                    resolve(conversations)
                                }
                            }
 
    