From the course: MongoDB Code Challenges: From Beginner to Advanced

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Find: Query operators { $gte, $in: [], etc }

Find: Query operators { $gte, $in: [], etc } - MongoDB Tutorial

From the course: MongoDB Code Challenges: From Beginner to Advanced

Find: Query operators { $gte, $in: [], etc }

- [Instructor] Welcome to CRUD Challenge four, Query Operators. Searching for data rarely involves simplistic name equals John type of queries. Often, we need to know if a raise include a value or if a number is greater than or equal to some other value, or if a date falls within some range. This is where the notion of query operators comes into play. For a normal field search, the syntax is simple. The object for the key is the field name and the value is what you're searching for. Query operators can take the place of that value. So instead of a simple query such as name equals John, you can use a query operator like Name, $, equal John to do the same thing. Here's the Query Operator is this $eq. You'll see it in the bottom example there where you're saying instead of just saying pure value, equal runs a function behind the scenes that checks for the name equal to a thing. Yes, that's more typing. Yes, that's less clear, but as your query needs to become more advanced, the ability…

Contents