title: Unable to fetch data after all data added to database in MONGODB,NODEJS
body: <p>Unable to fetch all the data after storing in the database, the below code returns empty but data is stored in the database</p>
  <pre><code>let cert;
  let arr = [];
  let insertedArray = [];
  const request = https.request(options, async function (res) {
      cert = await res.socket.getPeerCertificate(true);
      do {
          arr.push(cert);
          cert = cert.issuerCertificate;
      } while (cert &amp;&amp; typeof cert === 'object' &amp;&amp; !arr.includes(cert));
  
      const promises = arr.map(async (i) =&gt; {
          insertedArray.push({ common_name: url, valid_from: i.valid_from, valid_to: i.valid_to, issuer: i.issuer.CN, serial: i.serialNumber, location: i.subject.C, organization: i.subject.O });
          await techstack.findByIdAndUpdate(techstackId, {
              $push: {
                  sslDetails: insertedArray[0],
              },
          });
      });
      Promise.all(promises);
  });
  request.end();
  const techstackDetails = await techstack.findById(techstackId);
  return res.status(200).json({
      data: techstackDetails.sslDetails,
  });
  </code></pre>