Skip to content
Theory · MongoDB: Documents, Queries, Embed or Reference · lesson 3 of 12

Filters, projection and sort

In the last lesson we fetched cards by number. Now the barista searches by content: coffee drinks at 250 and up, all the teas, everything under 150. SQL has SELECT … WHERE … ORDER BY … LIMIT for this. In MongoDB find does the same: the first argument says which documents to take, and the second which fields to show. The methods after it set the sort and the batch.

In this lesson

  • The filter
  • Projection
  • Sort, skip and limit
  • Common mistake
  • Key points