title: MongoDB - Sort and Skip methods not working
body: <p>I am getting frustrated with these two methods. According to <a href="https://docs.mongodb.com/realm/mongodb/actions/collection.find/#example" rel="nofollow noreferrer">MongoDB documentation</a> I can find limit sort and skip something like this:</p>
  <blockquote>
  <pre><code>db.collection('demo_products').find({'groupid':{$exists: false}}).sort({'_id': 1}).limit(5).toArray()
  </code></pre>
  <p>But when I try it I get this error:</p>
  <pre><code>TypeError: db.collection(...).find(...).sort is not a function
  </code></pre>
  </blockquote>
  <p>I tried something different:</p>
  <blockquote>
  <pre><code>db.collection('demo_products').find({'groupid':{$exists: false}}, {limit: 5}).toArray()
  </code></pre>
  <p>and this worked well until I wanted to sort and skip:</p>
  <pre><code>db.collection('demo_products').find({'groupid':{$exists: false}}, {sort: {'_id': 1}}, {skip: 1}, {limit: 5}).toArray()
  </code></pre>
  </blockquote>
  <p>It completely disregarded sort and skip operations. I tried aggregation as well, but I couldn't find $exists operator in aggregation.
  I find <code>.find()</code> method more easier to use for me, but I can't figure out how to use sort and skip correctly.</p>
  <p>I find the documentation quite misleading since it's suppose to work, but it throws the error all the time I follow it.</p>