[Avg. reading time: 1 minute]
Operators
Comparison Operators
| MySQL | MongoDB |
|---|---|
| = | $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
| MySQL | MongoDB |
|---|---|
| and | $and |
| or | $or |
| not | $not |