Full-Stack Web Development with Vue.js and Node

(singke) #1
Introducing MongoDB Chapter 3

This outputs the following:


Finding documents via filters

We can add filters to the find() command as well. Let's retrieve documents with the name


Mike. For that, we can use:


> db.users.find({ name: 'Mike' })

It should return a document with the following:


We can also specify multiple conditions with AND or OR queries.


To find a collection with the name Mike and the email [email protected], we can simply


use:


> db.users.find({ name: 'Mike', email: '[email protected]' })
Free download pdf