1
00:00:02,120 --> 00:00:08,320
Now that we're able to get all products, let's also make sure we can get a single product and for that,

2
00:00:08,680 --> 00:00:15,140
I'll work on my get product action in the shop controller and there we extract the product ID which

3
00:00:15,140 --> 00:00:15,800
is great,

4
00:00:15,940 --> 00:00:17,950
I don't need this code here anymore

5
00:00:17,950 --> 00:00:18,540
by the way

6
00:00:18,760 --> 00:00:25,120
and the good thing is product is a mongoose model and mongoose indeed has a find by ID method,

7
00:00:25,150 --> 00:00:27,790
so little convenience method that defines for us.

8
00:00:27,790 --> 00:00:35,440
So again find by ID here is not our own method, it's defined by mongoose. And best of all, we can

9
00:00:35,440 --> 00:00:41,440
even pass a string to find by id and mongoose will automatically convert this to an object ID,

10
00:00:41,500 --> 00:00:43,750
so it will handle that for us as well,

11
00:00:43,750 --> 00:00:47,990
so again getting a lot of that convenience by just using mongoose

12
00:00:48,370 --> 00:00:51,610
and then we should be able to get back a product and use that.

13
00:00:51,850 --> 00:00:55,010
So actually this should be everything we need to do,

14
00:00:55,210 --> 00:00:55,680
nothing

15
00:00:55,690 --> 00:00:56,870
basically I guess.

16
00:00:57,070 --> 00:01:02,380
One thing I have to do of course is I have to comment that route back, so this route for loading

17
00:01:02,380 --> 00:01:09,940
a single product. With that if you save everything and you click on details here, we indeed see the detail

18
00:01:09,940 --> 00:01:11,970
page for this product.

19
00:01:11,980 --> 00:01:14,120
So this is now also working

20
00:01:14,200 --> 00:01:22,060
and that of course is really great because well this allows us to easily adjust our code to use mongoose.
