1 00:00:00,600 --> 00:00:02,730 In this park, we are going to create a model. 2 00:00:03,420 --> 00:00:07,560 So first we are going to create a folder called Models. 3 00:00:14,040 --> 00:00:19,040 And then inside of Hooda, we create a file called Items Thoughts. 4 00:00:20,100 --> 00:00:25,350 And we are going to use the mongoose package, so we need to use Leapai it. 5 00:00:29,370 --> 00:00:37,410 And then we need to get something from the mongoose copter, which is the skimmer, so we create a variable 6 00:00:38,370 --> 00:00:47,940 called schema is equal to one goose schema and then we set that constant item schema is equal to a new 7 00:00:48,300 --> 00:00:51,030 schema and their name is string. 8 00:00:51,060 --> 00:00:55,040 So we set a type string and it is required. 9 00:00:55,050 --> 00:01:01,370 So we said that we acquired it through and then the next property is the price. 10 00:01:02,220 --> 00:01:09,870 And if you do not, we acquired these properties, you can just name it as price and then number, but 11 00:01:10,410 --> 00:01:14,030 also want this and say we acquired properties. 12 00:01:14,430 --> 00:01:20,900 So we said and we said the type is number and required is true. 13 00:01:21,720 --> 00:01:24,980 And then we are going to enable the timestamp. 14 00:01:24,990 --> 00:01:33,690 So we need to put another properties here because the timestamps we said to you, when you enable this 15 00:01:33,690 --> 00:01:40,980 timestamped, the mongoose will at the create and update properties to your schema and by the force 16 00:01:40,980 --> 00:01:45,540 to create, add and update ahead of time date. 17 00:01:45,870 --> 00:01:52,970 So when you update the documents, the mongoose will automatically increments the update at at last. 18 00:01:52,970 --> 00:01:56,920 And we are going to create a model based on this schema. 19 00:01:57,390 --> 00:02:08,130 So we set a constant item is equal to one good thought model and then the Nemitz items and then we use 20 00:02:08,130 --> 00:02:15,650 the schema of item schema and at last we will export that so that we can use it in elsewhere. 21 00:02:15,990 --> 00:02:22,310 So we use for export use equal to item. 22 00:02:22,740 --> 00:02:30,900 And this is a very important item because it will look at this name and popularizes and then look for 23 00:02:30,900 --> 00:02:33,580 the collections inside a Mongo DB. 24 00:02:33,810 --> 00:02:43,050 For example, if you as items, we will look for the collection items and if you name it as apples and 25 00:02:43,050 --> 00:02:47,910 then it will find that the collections name as appose. 26 00:02:48,210 --> 00:02:55,320 So this word is very important for finding the connections so we can get back to items.