Chapter 4 IDE, redundant equality operator

in chapter 4 IDE we have following question for excecise, although these are pretty simple question but

1. Find all documents where the trip was less than or equal to 70 seconds
and the usertype was “Customer” using a redundant equality operator.

db.trips.find({tripduration:{\$lte:70},usertype:{\$ne:‘Subscriber’}}).count()

2. Find all documents where the trip was less than or equal to 70 seconds
and the usertype was “Customer” using the implicit equality operator.

in the above 2 question what do we mean by redundant equality operator. and implicit equality operator. ?

are we referring \$ne for redundant equality operator and \$eq for implicit equality operator ?

Thanks
Rishabh Agrawal

Hi,

``````//redundant
{ a:{ \$eq: "b" }}
//implicit
{ a: "b" }
``````

Redundant here means “un-necessary”, because it will be added automatically under the hood.

You can run `db.coll.find({ a: "b" }).explain()` to see how the `\$eq` is added.

1 Like