Welcome back.
In this video, let's see how we can fetch the documents we have created into our application.
So here we go.
Let me comment this one.
Otherwise, it's going to create a gain.
So here we go.
So here, let's have a beautiful command.
Say, fine or students.
So which method are you going to use?
So back to the documentation.
We are going to use a method called read meaning, read, document and here retrieve data and here we
go.
So scroll down and want to see find.
So find is a method on the collection object that references the collection you want to query.
So all I need is to use find on my collection, which is student and that is it.
So back to Visual Studio code.
Here we go.
Cost or make use of all students.
Is equal to await the action.
And next is my student collection.
And on that, we're going to use a method called find and call it as a function.
So for fine, we can pass an additional agreement called queries and we will get there very soon.
For the meantime, let's stick to this core find.
All right.
So let's try to console.log our student and let's see what we are going to get.
We are going to get the actual student, but let's see what I mean.
So now back to the terminal here.
Let me shut down, clear the console, and now let's run the file again and let's see what is going
to happen.
Scroll up.
I'm going to see something strange here about the fine method so you can see that what it retains is
what we call cursor.
Well, cursor simply means that when we're making the query, MongoDB is a way to find the entire record
at GO.
It is coming in piece by piece and to get the actual record unless we pass it as an array.
So here we go.
So for find I'm going to obtain a method call to array.
So here we go to array like that and save it again.
Let's run the file again.
Let me shut down and click the console and run it again.
Now let's see.
A I get array of students inside the terminal.
Remember, we have a name with underscore ID and this one was given to us by MongoDB to identify a particular
record.
And you can see that all the IDs are different.
You can see so meaning that this ID represents the individual record.
So that is it about how we can find a record, but we cause something.
Query It means that let's say for this record we want to find a student by name John Doe, how are we
going to do it?
Or we want to find a student by name from us who is from Western region.
How are we going to do it?
So let me show you how we are going to do this one in the next video.