title: How to use Promise.all with mongoose queries as arguments
body: <p>I'd like to 2 of mongoose queries to run as Promise object via <code>Promise.all()</code> function.</p>
  
  <p>If 2 of queries are successfully completed, I'd like to return the results and use them in next <code>then()</code> function like below.</p>
  
  <p>mongoose query 1:</p>
  
  <pre><code>const _getColRank = (colPoint) =&gt; {
    return User.$where('this.email !== "admin@admin"').count({ colPoint: { $gt: colPoint } }).exec();
  };
  </code></pre>
  
  <p>mongoose query 2:</p>
  
  <pre><code>const _getBattleRank = (battlePoint) =&gt; {
    return User.$where('this.email !== "admin@admin"').count({ battlePoint: { $gt: battlePoint } }).exec();
  };
  </code></pre>
  
  <p>Promise.all():</p>
  
  <pre><code>Promise.all([_getColRank(user.colPoint), _getBattleRank(user.battlePoint)])
  .then(ranks =&gt; {
    User.findByIdAndUpdate(_id, { colRank: ranks[0], battleRank: ranks[1] }, { upsert: true }).exec();
  }
  </code></pre>
  
  <p>Unluckily they always return zero. Now I can't find out what the problem is, so need your help. Please teach me.</p>