Handle two read operation in different table using nodejs & mongoDb causing socket hang up

Viewed 13

I'm facing an issue with socket hang up, by using this function below, When I use any one of the get queries it works well but when I used two get queries into two different collections then causes a socket hang up error. I don't wanna use Promise & then. In that case how I can get rid of this?

const getBooksForUser = async ({query: {memberID, role, guide}, headers}, res) => {
        let books =  await getBooks(role, guide, "Live")
        let basicBooks =await getBasicBooks(role, guide, "Live");
        let mergeCourses = [...books, ...basicBooks];
}
0 Answers
Related