1
00:00:06,620 --> 00:00:07,880
Welcome back.

2
00:00:07,910 --> 00:00:15,170
In this video, let's see how we can fetch the documents we have created into our application.

3
00:00:15,170 --> 00:00:16,640
So here we go.

4
00:00:16,670 --> 00:00:18,350
Let me comment this one.

5
00:00:18,350 --> 00:00:20,990
Otherwise, it's going to create a gain.

6
00:00:20,990 --> 00:00:23,360
So here we go.

7
00:00:23,570 --> 00:00:26,150
So here, let's have a beautiful command.

8
00:00:26,150 --> 00:00:28,610
Say, fine or students.

9
00:00:28,610 --> 00:00:30,950
So which method are you going to use?

10
00:00:31,220 --> 00:00:33,410
So back to the documentation.

11
00:00:33,410 --> 00:00:41,180
We are going to use a method called read meaning, read, document and here retrieve data and here we

12
00:00:41,180 --> 00:00:41,510
go.

13
00:00:41,510 --> 00:00:44,270
So scroll down and want to see find.

14
00:00:44,270 --> 00:00:50,870
So find is a method on the collection object that references the collection you want to query.

15
00:00:50,870 --> 00:00:57,380
So all I need is to use find on my collection, which is student and that is it.

16
00:00:57,530 --> 00:01:00,140
So back to Visual Studio code.

17
00:01:00,170 --> 00:01:01,520
Here we go.

18
00:01:01,610 --> 00:01:04,550
Cost or make use of all students.

19
00:01:05,840 --> 00:01:09,410
Is equal to await the action.

20
00:01:09,410 --> 00:01:12,080
And next is my student collection.

21
00:01:12,080 --> 00:01:18,140
And on that, we're going to use a method called find and call it as a function.

22
00:01:18,140 --> 00:01:24,380
So for fine, we can pass an additional agreement called queries and we will get there very soon.

23
00:01:24,380 --> 00:01:27,740
For the meantime, let's stick to this core find.

24
00:01:28,010 --> 00:01:28,790
All right.

25
00:01:28,790 --> 00:01:33,620
So let's try to console.log our student and let's see what we are going to get.

26
00:01:33,650 --> 00:01:39,260
We are going to get the actual student, but let's see what I mean.

27
00:01:39,530 --> 00:01:42,320
So now back to the terminal here.

28
00:01:42,500 --> 00:01:49,310
Let me shut down, clear the console, and now let's run the file again and let's see what is going

29
00:01:49,310 --> 00:01:50,090
to happen.

30
00:01:50,090 --> 00:01:51,230
Scroll up.

31
00:01:51,230 --> 00:01:58,730
I'm going to see something strange here about the fine method so you can see that what it retains is

32
00:01:58,730 --> 00:02:00,530
what we call cursor.

33
00:02:00,530 --> 00:02:09,500
Well, cursor simply means that when we're making the query, MongoDB is a way to find the entire record

34
00:02:09,509 --> 00:02:10,400
at GO.

35
00:02:10,490 --> 00:02:17,900
It is coming in piece by piece and to get the actual record unless we pass it as an array.

36
00:02:17,900 --> 00:02:19,790
So here we go.

37
00:02:19,790 --> 00:02:25,280
So for find I'm going to obtain a method call to array.

38
00:02:25,280 --> 00:02:32,120
So here we go to array like that and save it again.

39
00:02:32,120 --> 00:02:34,340
Let's run the file again.

40
00:02:34,550 --> 00:02:39,710
Let me shut down and click the console and run it again.

41
00:02:39,740 --> 00:02:41,030
Now let's see.

42
00:02:42,090 --> 00:02:46,780
A I get array of students inside the terminal.

43
00:02:46,830 --> 00:02:56,070
Remember, we have a name with underscore ID and this one was given to us by MongoDB to identify a particular

44
00:02:56,070 --> 00:02:56,640
record.

45
00:02:56,880 --> 00:03:00,950
And you can see that all the IDs are different.

46
00:03:00,960 --> 00:03:06,900
You can see so meaning that this ID represents the individual record.

47
00:03:07,020 --> 00:03:13,620
So that is it about how we can find a record, but we cause something.

48
00:03:13,620 --> 00:03:23,130
Query It means that let's say for this record we want to find a student by name John Doe, how are we

49
00:03:23,130 --> 00:03:24,120
going to do it?

50
00:03:24,150 --> 00:03:29,580
Or we want to find a student by name from us who is from Western region.

51
00:03:29,580 --> 00:03:31,410
How are we going to do it?

52
00:03:31,650 --> 00:03:37,380
So let me show you how we are going to do this one in the next video.

