From the course: MongoDB C# Developer Associate Cert Prep

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Finding documents in a MongoDB collection

Finding documents in a MongoDB collection - MongoDB Tutorial

From the course: MongoDB C# Developer Associate Cert Prep

Finding documents in a MongoDB collection

- Welcome. In this video, you'll learn how to find documents in a collection by using the find() method. You'll also learn how to use the $in operator when using the find() command. Before jumping into our database, let's take a moment to look at the syntax for the find() method. To use the find() method appendant to the database and collection name in this format, db.<collection>.find(). For this example, we'll work with a database called training and query it's collection called zips. We can use the find() method to view all the documents in the collection. To do this, we run db.zips.find(). This returns a cursor with the results which are addresses in the United States. The Shell will automatically iterate through our cursor once the results are returned. To see more results, we can use the IT shell directive which will iterate through the long list of results. Let's type it and press enter a couple of times…

Contents