From the course: MongoDB Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

findOne and find

findOne and find

- [Instructor] You've also already used the find commands, but also here, there are some options that we didn't cover that you should know about. To briefly recap, you can find a single document with the findOne command and you can optionally specify any fields to match on in a document that you pass in. And you can find many documents at once with a .find command. Let's look at the data that we imported into our MongoDB database in the beginning. Okay, to do this, we're going to have to switch database to our sample data database. Just to remind you, if you want to see what all of the databases in your MongoDB deployment look like, you can get that by typing in show dbs and that will return all of the databases that are in your deployment. All right, so we want to use the sample data database. Okay, now let's look at what collections are present. Cool. So we've got the inventory collection, the movies collection and…

Contents