Grokking MongoDB
0% completed
Introduction to Operators in MongoDB
These two filters look almost the same, but they ask different questions.
db.users.find({ age: 30 }) // age is exactly 30 db.users.find({ age: { $gt: 30 } }) // age is greater than 30
A plain value can only ask for equality. To ask for anything else, you replace the value with a small document whose key starts with a dollar sign. That key tells the server what to do with the value, and it is called an operator. Here, $gt means "greater than".
Operators appear wherever MongoDB needs an instruction rather than data
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%