MongoDB Operators

ImongoDBn previous two posts of MongoDB, i discussed about

1. What is MongoDB and how to install it

2. Query Document in MongoDB

In this post i am going to discuss about MongoDB operators.

I finished last post by updating a new field in MongoDB called salary

MongoDB Operators

$gt greater than.

$gte greater than or equal to.

$in matches value that exist in an array.

$lt less than.

$lte less than or equal to.

$ne not equal to.

$nin matches value that do not exist in an array.

Subscribe Our Tutorials

Get Latest Updates on Facebook

Find the records of an employee whose salary is greater than 20000

In MySQL, we write

To only retrieve salary field

Salary is less than 20000

Less than 20000 and greater than 40000

Find all the employees whose firstname is raj or robin

Find all the employees whose firstname is not raj or robin

Returns all rows whose salary is not equal to 45000

You can explore some more operators from MongoDB documentation.

WebRewrite

About WebRewrite

I am technology lover who loves to keep updated with latest technology. My interest field is Web Development.
Tagged , . Bookmark the permalink.