Summary
We started this chapter with a detailed study of the structure of MongoDB queries and how different they are from SQL queries. Then, we implemented these queries to find and count the documents and limit the number of fields returned in the result using various examples. We also learned about the various conditional and logical operators and practiced using them in combination to notice the difference in results.
We then learned how to provide a text pattern using regular expressions to filter our search results, and covered how to query arrays and nested objects and include their specific fields in the results. Finally, we learned how to paginate large result sets by using limiting, sorting, and skipping on the documents in the result.
In the next chapter, we will learn how to insert, update, and delete documents from MongoDB collections.