0

Consider the code:

const id=aux[0].healthyTissue[0];
const aux4 = await Hidden.findById(id).populate(
    "children"
);

As you may have noticed, aux is an array and so is aux[i].healthyTissue[0].

Problem: I want to gather all the information in a single array called aux4, as I am doing for index equal 0, I want an automatic way to search inside all the arrays.

I have tried something like ForEach and map, with no success, I cannot make it wait for the result, it keeps coming empty on the following res.json I thought about pipe, however, I could make it work on this case.

Obs. the code showed works, but I want to go through all the elements, gather them in a single array, and return in a res.json

0 Answers0