Basically, MongoDB is an Object-Oriented Database where we not only use MongoDB Query to fetch the results, we can also use this JavaScript like expressions to operate the data from database. We can use some basic operations like ‘&&’, ‘>’, ‘!=’, etc. below is the example for both JavaScript and MongoDB Querying.

Example: trying to get the results with style number greater than 600000 and style description not equal to MM GRAPHIC PO HOOD.

Query using JavaScript expression:

" > 600000 && !='MM GRAPHIC PO HOOD'"


Query using MongoDB Syntax:
"style.description":{$ne:"MM GRAPHIC PO HOOD"}}

Performance matters:

                 To get the best performance, use the Mongo Query rather than javaScript expression to fetch the results.