title: sorting in mongoose is providing random result
body: <p><strong>I have a collection named payments with field named 'sorter' in it, I want to sort my results descending with the 'sorter' field</strong>
  I have no Idea how to do it</p>
  <pre class="lang-js prettyprint-override"><code>return ApiProtectedRoute(
    req,
    res,
    (protectedUserid, protectedUsername, protectedEmail, protectedBalance) =&gt; {
      paymentModels
        .find({
          userId: protectedUserid
        }, function(err, payments) {
          if (payments.length == 0) {
            res.status(400).json({
              error: true,
              message: &quot;No payments found&quot;,
              info: &quot;getPayments&quot;,
            });
          } else if (payments.length &gt; 0) {
            let paymentsWithUsername = [];
            payments.forEach((payment) =&gt; {
              userModels.findOne({
                _id: payment.userId
              }, function(err, user) {
                if (err) console.log(err);
                paymentsWithUsername.push({
                  ...payment._doc,
                  username: user.username,
                  email: user.email,
                });
                if (paymentsWithUsername.length === payments.length) {
                  res.status(200).json({
                    error: false,
                    payments: paymentsWithUsername,
                    info: &quot;getPayments&quot;,
                  });
                }
              });
            });
          } else {
            res.status(400).json({
              error: true,
              message: &quot;Something went wrong&quot;,
              info: &quot;getPayments&quot;,
            });
          }
        })
        .sort({
          sorter: -1
        });
    }
  );
  </code></pre>
  <p>this code shows random result at everytime</p>
  <p>Payments collection:</p>
  <p><a href="https://i.stack.imgur.com/nXbs7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nXbs7.png" alt="payments collection" /></a></p>