Live Batches
Masterclasses
Menu
Free Courses
Account
Login / Sign Up
Mongo DB Comparison Operators

Mongo DB Comparison Operators

Intermediate 1 min read 16 Jul 2025 15K views
Mongo DB Comparison Operators
In RDBMS, you can use comparison operators like as >, <, <=, and >= while writing a SQL query. Mongo shell also has the same comparison operators but they are used with a different notation. Here is a comparison list of Mongo shell operators and SQL operators.

If you're new to MongoDB, taking a Mongodb Certification Free can be a great way to understand how these operators work in real-world queries.

Mongo Shell Operators
SQL Operators
gt
>
lt
<
gte
>=
lte
<=

AND and OR Operators

Like RDBMS, MongoDB also supports OR and AND operators. You can use $or for an OR operator and $and for an AND operator.

db.users.find( { $or : [{lastname :"chauhan",lastname:"kumar"}] })
db.users.find( { $and : [{firstname :"deepak",lastname:"kumar"}] })
What do you think?
That’s it for now! I hope you get a good idea how to use Mongo shell comparison operators to query your mongo database. I would like to have feedback from my blog readers. Your valuable feedback, question, or comments about this article are always welcome.

Also, if you're looking to dive deeper, consider enrolling in a Mongodb Free Course to strengthen your skills and practice hands-on.

Test yourself in 5 minutes

Take the free Mongodb skill challenge to see your strengths and the gaps to fix next.

Start the challenge
Share LinkedIn X Facebook WhatsApp

About the author

Shailendra Chauhan

Shailendra Chauhan

Microsoft MVP, Founder & CEO at ScholarHat

He is a renowned Speaker, Solution Architect, Mentor, and 11-time Microsoft MVP (2016–2026). With expertise in AI/ML, GenAI, System Design, Azure Cloud, .NET, Angular, React, Node.js, Microservices, DevOps, and Cross-Platform Mobile App Development, he bridges traditional frameworks with next-gen innovations.

He has trained 1 Lakh+ professionals across the globe, authored 45+ bestselling eBooks and 1000+ technical articles, and mentored 20+ free courses. As a corporate trainer for leading MNCs like IBM, Cognizant, and Dell, Shailendra continues to deliver world-class learning experiences through technology & AI.

Keep learning

Courses that go with this tutorial