1
00:00:08,370 --> 00:00:09,510
In this video.

2
00:00:09,510 --> 00:00:16,710
Let's get started with how we can model data after we have explained the concept.

3
00:00:17,130 --> 00:00:25,200
As usual, I have created a sample express server and I will provide this set of files for you.

4
00:00:25,230 --> 00:00:29,790
Or better still, you can start with your own x server.

5
00:00:29,820 --> 00:00:33,340
So let's look at the folders and files in it.

6
00:00:33,360 --> 00:00:38,700
Again, this section is all about express or how to work with Mongoose.

7
00:00:38,700 --> 00:00:42,480
Because for this one too, we have covered in details.

8
00:00:42,600 --> 00:00:51,750
I have one folder called models and inside I have two files post model and then the user model.

9
00:00:51,870 --> 00:00:54,330
Let's look at the post model files.

10
00:00:54,570 --> 00:01:03,150
You can see I have title here and then the content and down here I created my model.

11
00:01:03,180 --> 00:01:08,940
After I compiled my schema and exported the post I start.

12
00:01:09,120 --> 00:01:16,470
That is the first file and a second file is going to be the users for user registration and for the

13
00:01:16,470 --> 00:01:17,160
user.

14
00:01:17,190 --> 00:01:25,680
I have one field code full name and then the country and I have compiled the schema to form user and

15
00:01:25,680 --> 00:01:26,700
have exported.

16
00:01:26,700 --> 00:01:33,240
I start and the next folder are going to be the root to create and then register user.

17
00:01:33,330 --> 00:01:41,750
I have first root called post root and inside the root I have the function to create the post and save

18
00:01:41,760 --> 00:01:42,900
into database.

19
00:01:42,900 --> 00:01:44,130
And this one too.

20
00:01:44,160 --> 00:01:49,140
There is nothing new until this point, and next root is to fetch all posts.

21
00:01:49,140 --> 00:01:50,370
And that is it.

22
00:01:50,400 --> 00:01:54,990
The next root also for users for user registration.

23
00:01:54,990 --> 00:01:57,990
And this is a function for registration.

24
00:01:57,990 --> 00:02:04,950
And this function or this root is for fetching all users and that is it about that folder.

25
00:02:05,280 --> 00:02:14,280
The next folder is called the Utils and inside I have one file called DB Connect and this is a function

26
00:02:14,280 --> 00:02:16,170
to connect to MongoDB.

27
00:02:16,350 --> 00:02:23,940
You can see that I just export the connection from this file and I can connect to Mongoose or MongoDB

28
00:02:23,970 --> 00:02:24,990
using a function.

29
00:02:24,990 --> 00:02:29,640
But I think this is the easiest way to go and how to connect to MongoDB too.

30
00:02:29,670 --> 00:02:33,330
We have covered in details and on the server file.

31
00:02:33,360 --> 00:02:40,890
I have required those files and this file is to connect to MongoDB and my express and I have required

32
00:02:40,950 --> 00:02:49,620
those two routes and here is my middleware to pass incoming payload and then the route handles and my

33
00:02:49,620 --> 00:02:53,060
server is listening on port 3000.

34
00:02:53,070 --> 00:02:56,790
So that is it about the files and folders.

35
00:02:56,850 --> 00:03:05,040
And we are going to use these tools called Compas to able to visualize our database and better so we

36
00:03:05,040 --> 00:03:08,460
can use the voice code extension for MongoDB.

37
00:03:08,490 --> 00:03:12,840
And here I can look through my database also.

38
00:03:13,050 --> 00:03:18,450
All right, so these are the folders and tools we are going to use to work with data modeling.

39
00:03:18,540 --> 00:03:19,650
Then this video.

40
00:03:19,650 --> 00:03:26,880
Let's get started with the first concept that is working with how we can relate document together using

41
00:03:26,880 --> 00:03:28,410
the embedded way.

