I want to return a value and store it in a variable. I don't know this can be possible or not but I tried to so
let demo = await Promise.all(
                    Shop.findAll({
                      where: {
                        product_id: child.id,
                      },
                      attributes: ["id", "address"],
                    })
                      .then((adds) => {
                        adds.map(async function (add) {
                          let path = add.address;
                          return path;
                        });
                      })
                      .catch(function (err) {
                        reject(err);
                      })
                  );
                  console.log(demo);All I am getting is demo = []
- As my expected ouput from demo is
New York
London
Mumbai
Sydney
- And in reality I am getting demo= []
What I am trying to do is that I need the address of the shop in the parent function as Shop is my child function so my actual code looks like this
Owner.findAll({
            raw: true,
            where: {
              id: owner.id,
            },
            attributes: ["id", "name", "address"],
          })
            .then(async (children) => {
              await Promise.all(
                children.map(async function (child) {
                 let ownerName = child.name;
                 
                  let demo = await Promise.all(
                    Shop.findAll({
                      where: {
                        product_id: child.id,
                      },
                      attributes: ["id", "address"],
                    })
                      .then((adds) => {
                        adds.map(async function (add) {
                          let path = add.address;
                          return path;
                        });
                      })
                      .catch(function (err) {
                        reject(err);
                      })
                  );
                 // I want to use demo in getStatus function
                  await getStatus(ownerName,demo);
                })
              );
            })
            .catch(function (err) {
              reject(err);
            });I want to use shop data in my owner data
 
    