title: ProductArray is staying empty after coming out of the loop
body: <p>I added the productArray array and need the data from products into that array. When I console.log it inside the loop it's working, but taking it out doesn't work.
  I am rendering it in ejs.</p>
  
  <pre><code>exports.getOrderById = (req, res, next) =&gt; {
    let user = req.user
    User.findById(user._id).exec((err, purchase)=&gt;{
      if(err){
        return res.status(400).json('Error')
      }
     else {
       let item = purchase.order
       let productArray = []
       item.forEach(function(items){
         Product.findById(items.productId._id).exec((err, products)=&gt;{
            productArray.push({
             productName: products.name,
             productPrice: products.price
           })
           console.log(productArray[0].productName)
          })  
  
        })       
       res.render('cart', {item: [item], products: [productArray]} )
     }
    })
  };
  </code></pre>