Introducing MongoDB Chapter 3
The comma operator means an AND operator. We can specify as many conditions as we like
with comma-separated values. The preceding command should output:
Now, specifying conditions with AND or comma operators is simple. If we want to use the
OR operator, then we should use:
> db.users.find(
{
$or: [ { email: "[email protected]" }, { name: "Mike" } ]
}
)
Here, we are saying: retrieve those documents for users whose name is Mike, and the email
can be [email protected] as well. The output is as follows:
Updating documents
Just like insert(), there are three methods of using the update() command in MongoDB:
updateOne(), updateMany(), and update().