WEBVTT

00:00.800 --> 00:01.800
Hi everyone!

00:01.800 --> 00:09.240
In this video I will show you how we can define the schema in the Netflix with the MongoDB.

00:09.440 --> 00:22.080
Okay, so but before try to create a schema, firstly we need to create a subfolder structure okay some

00:22.080 --> 00:23.200
define structure.

00:25.320 --> 00:29.680
In here let's click on create and click on the users right here.

00:30.840 --> 00:40.920
Well in the legend we can use the nest new command to generate the folder okay we call it legend.

00:40.960 --> 00:45.520
We should follow the controller module and service right.

00:45.840 --> 00:50.320
So for that reason in order to do that firstly I will click on the next.

00:50.360 --> 00:56.920
Then right here we can generate the files by on schematics.

00:57.800 --> 00:59.440
Let me show you how we can do that.

00:59.600 --> 01:05.340
We can use the next generation and move the some schematics and move the name of the folder and you

01:05.340 --> 01:06.220
can move the option.

01:06.540 --> 01:09.700
Let me uh, 0111111.

01:14.900 --> 01:16.100
Right here is symmetric.

01:16.100 --> 01:17.700
We have so many symmetric.

01:17.740 --> 01:21.180
Like for example I create a new class okay.

01:21.380 --> 01:28.820
This is the alias or create controller decorator create filter okay.

01:28.860 --> 01:34.180
Something like that in the file right here right now I will see you using the resource.

01:34.500 --> 01:39.860
The reason because it will generate the new cross resource okay.

01:40.300 --> 01:45.300
You can click on that to see what exactly does first generator TypeScript.

01:45.980 --> 01:47.820
Right here we are using the.

01:47.820 --> 01:51.420
Net generate resource right.

01:51.460 --> 01:56.580
It will define for you the sun and Mars like that.

01:58.100 --> 01:59.980
So let me show you how it works.

02:00.660 --> 02:02.500
And inside here we have a sub option.

02:03.340 --> 02:08.760
In this project we will disable the That's fine.

02:08.800 --> 02:09.200
Right?

02:12.720 --> 02:13.240
Right here.

02:13.280 --> 02:15.120
This is the test file.

02:15.400 --> 02:19.360
I will not test in this project for saving of time.

02:19.520 --> 02:21.160
So I will use the option nodes.

02:21.840 --> 02:22.680
Let me show you.

02:26.240 --> 02:26.760
Hello.

02:27.120 --> 02:30.720
I will use it against generous resource.

02:31.600 --> 02:32.160
Right.

02:32.200 --> 02:35.840
And I will name folders will be possible user.

02:36.280 --> 02:36.760
Okay.

02:37.480 --> 02:40.120
And I will put option middle spot.

02:40.680 --> 02:42.720
Let us and let's enter.

02:46.240 --> 02:49.400
Right here I will use the rest API.

02:50.680 --> 02:52.880
And would you like to generate the cross.

02:52.920 --> 02:53.800
Okay I will.

02:53.840 --> 02:54.240
Yes.

02:55.520 --> 03:01.400
Right here you can see if we overwrite it will create for you automatically the user folder.

03:01.560 --> 03:05.120
Inside the user folder we have a controller module.

03:06.080 --> 03:06.600
Okay.

03:06.880 --> 03:07.680
And serve it.

03:07.680 --> 03:10.000
And we also have some entity over here.

03:10.290 --> 03:11.650
We will use our entity.

03:12.210 --> 03:12.490
Okay.

03:12.530 --> 03:15.650
This entity we will define the schema okay.

03:16.250 --> 03:18.130
We will change the folder structure.

03:19.530 --> 03:25.890
We will change the folder name from entities to schemas for consistency with our.

03:29.290 --> 03:30.650
Modibodi okay.

03:32.530 --> 03:33.610
All right.

03:34.410 --> 03:36.850
And we also have a deal by default.

03:38.050 --> 03:41.170
That is you already got a fundamental right.

03:41.850 --> 03:42.050
Right.

03:42.050 --> 03:43.770
Now let me define the user.

03:44.050 --> 03:48.530
And then I will change those schemas inside here.

03:48.530 --> 03:50.650
Let me change the user schema.

03:53.210 --> 03:56.090
Dot txt and we will define some class.

03:56.610 --> 03:58.250
Let's say how we can define us.

03:58.530 --> 04:05.930
Firstly we will use the schema decorator okay let me do that.

04:07.730 --> 04:10.210
And we need to import class right.

04:14.030 --> 04:15.150
Sorry, we don't have.

04:15.190 --> 04:16.470
See my column over here.

04:16.950 --> 04:23.110
And in order to define, we will define some class, some property.

04:23.670 --> 04:24.110
Okay.

04:24.150 --> 04:25.990
And so we use the prop over here.

04:26.550 --> 04:27.030
Okay.

04:32.910 --> 04:33.470
Follow.

04:33.750 --> 04:35.070
I will define a username.

04:44.990 --> 04:45.510
Password.

04:48.670 --> 04:49.230
Okay.

04:49.270 --> 04:51.950
It later we will add more and more property over here.

04:51.950 --> 05:03.790
But right now let's just test that and let's see how we can do this after we already define the schema.

05:06.190 --> 05:13.070
Let me say let me scroll a little bit inside the import of the current module.

05:13.630 --> 05:17.450
We will import the module module and register.

05:18.690 --> 05:19.210
Okay.

05:20.770 --> 05:22.290
Right now, let me copy everything over here.

05:22.890 --> 05:23.130
Okay?

05:23.170 --> 05:24.010
Never mind.

05:24.370 --> 05:26.970
Try to memorize.

05:27.090 --> 05:28.450
Let me show you how we can find out.

05:28.450 --> 05:30.610
So you can click inside of those okay.

05:30.650 --> 05:33.650
You can click inside of goes inside of models.

05:33.690 --> 05:35.450
Let's click inside the model injection.

05:35.650 --> 05:37.530
Model injection over here okay.

05:37.770 --> 05:44.610
And right here your job is to scroll down a little bit to see this okay.

05:51.730 --> 05:53.090
These are the user model.

05:53.410 --> 05:55.650
Let me put the import statement.

05:56.930 --> 06:01.610
And we import the module and lots of feature.

06:01.970 --> 06:07.130
And right here let me import the user username okay.

06:07.690 --> 06:08.730
And user.

06:11.530 --> 06:12.090
Right here.

06:12.570 --> 06:16.090
Let's see where this comes from.

06:17.170 --> 06:18.490
It comes from.

06:25.470 --> 06:25.870
Okay.

06:28.030 --> 06:30.390
Make sure we will create us.

06:30.790 --> 06:31.030
Okay.

06:31.030 --> 06:33.150
I feel like we need to create a script.

06:36.310 --> 06:36.750
Okay.

06:37.590 --> 06:42.510
As not memorized as I will create a user document.

06:42.990 --> 06:47.350
And we need to import the documentation and the user over here.

06:47.750 --> 06:53.590
After we already got the document we will explore the schema over here.

06:54.350 --> 07:00.710
So my user schema and the schema and you want to user okay.

07:01.110 --> 07:03.350
So that is right here.

07:03.390 --> 07:07.550
Let's put the user schema over here right.

07:07.790 --> 07:11.670
Right now you might ask me what exactly about documentation.

07:11.670 --> 07:14.550
What exactly about high res document.

07:14.910 --> 07:18.630
Uh what is the schema for class?

07:18.670 --> 07:20.790
Well, it doesn't really matter.

07:21.350 --> 07:28.770
The only thing you need to know is how we can define a sub schema, and thus will be very enough for

07:29.170 --> 07:31.370
most of job applications out there.

07:31.810 --> 07:38.770
Okay, you don't need to try to understand what exactly about how the document or schema factory or

07:39.650 --> 07:41.970
what exactly does it does really matter.

07:42.010 --> 07:44.530
Okay, it's just about the rules.

07:45.010 --> 07:50.530
And since we use the framework we need to follow the rules.

07:50.570 --> 07:51.090
Okay.

07:51.210 --> 07:52.770
The rules of the framework.

07:53.130 --> 07:54.530
For that reason it is okay.

07:55.170 --> 07:56.290
Let's ignore that.

07:56.330 --> 07:57.610
You don't need to understand.

07:57.850 --> 07:58.370
Okay.

08:03.210 --> 08:06.730
And let's say we already start the application.

08:07.890 --> 08:10.450
Let me go to the project and let me refresh.

08:20.010 --> 08:21.850
Let me click inside the cluster.

08:22.770 --> 08:25.090
Click on Browse collections.

08:29.460 --> 08:30.020
And right here.

08:30.020 --> 08:31.540
We already got the users.

08:32.460 --> 08:32.940
Okay.

08:33.100 --> 08:34.860
It comes from user schema.

08:35.340 --> 08:38.620
It will auto generate for use this name.

08:38.900 --> 08:39.340
Okay.

08:39.380 --> 08:43.140
But right now we got the database name will be test.

08:43.660 --> 08:44.660
I don't want that.

08:44.940 --> 08:45.420
Right.

08:45.820 --> 08:47.100
So for that reason.

08:50.860 --> 08:55.020
Inside that module let's change the name of the project.

08:55.180 --> 08:56.020
Let me show you.

08:58.780 --> 09:03.260
In order to change the name of the project, let me show that.

09:03.620 --> 09:04.020
Okay.

09:05.500 --> 09:07.700
Not just how to rename the database.

09:09.620 --> 09:12.380
You can show the submit.

09:17.460 --> 09:19.860
That's not what we want right here.

09:27.780 --> 09:28.460
I will just.

09:30.320 --> 09:31.000
Project.

09:31.000 --> 09:32.320
How to rename a database.

09:33.040 --> 09:33.520
Okay.

09:36.760 --> 09:37.160
Sorry.

09:41.560 --> 09:49.840
In order to rename database after the localhost after the URL, we just need to put the name over here

09:50.040 --> 09:54.520
between after this thing right here.

09:57.160 --> 09:58.360
Let me boost again.

09:58.520 --> 09:58.960
Okay.

09:59.000 --> 10:03.240
Let me put the name will be also megabyte okay.

10:03.440 --> 10:04.120
Like that.

10:05.280 --> 10:11.400
And let's refresh the application and refresh the database also.

10:14.560 --> 10:15.760
So here we already got this.

10:15.760 --> 10:20.480
Also let me rock the test database.

10:20.760 --> 10:23.480
Let's go and run the test.

10:28.840 --> 10:31.560
So that's for the video I hope you understand.

10:31.880 --> 10:32.880
I will see you in the next.
