title: Node | Promise not finishing
body: <p>I am trying to fetch data of different collections from MongoDB. I do this with Node.js and promises. Here is some basic code:</p>
  <pre><code>await Promise.all(
          [&quot;a&quot;, &quot;b&quot;, &quot;c&quot;].map(async (collection) =&gt; {
              const query: any = { &quot;_id&quot;: { $in: ids} }
              // I just use toArray for demonstration purposes
              const data = await this.db!.collection(collection).find(query).toArray()
              for (let i = 0; i &lt; data.length; i++) {
                  const document = data[i]
                  // Do something...
              }
              console.log(collection)
              return true
          })
      )
   console.log(&quot;done&quot;)
  </code></pre>
  <p>I do this for eight collections (a, b, ..., h). The data gets fetched from the database and processed correctly in an acceptable amount of time. Then it prints the name for each collection. But it doesn't continue. It doesn't finish the promise and go to the done log.</p>
  <p>The method gets called in a JS-Worker task. What could be the problem here? I never had problems with promises and bigger amount of data yet.</p>