[Avg. reading time: 1 minute]

Operators

Comparison Operators

MySQLMongoDB
=$eq
<>$ne
>$gt
<$lt
>=$gte
<=$lte
in$in
not in$nin

Example

//

db.friendsCollection.find(
    {"lastname":{$nin:["Geller","Green"]}}
)

// 

db.friendsCollection.find(
    {"lastname":{$nin:["Geller","Green"]}}
).count()

Logical Operators

MySQLMongoDB
and$and
or$or
not$not

#mongodb #operatorsVer 5.5.3

Last change: 2025-10-15