﻿1
00:00:00,673 --> 00:00:03,770
‫Now, another extremely important feature

2
00:00:03,770 --> 00:00:07,200
‫of a good API is to provide pagination.

3
00:00:07,200 --> 00:00:09,040
‫So basically allowing the user

4
00:00:09,040 --> 00:00:12,660
‫to only select a certain page of our results,

5
00:00:12,660 --> 00:00:15,373
‫in case we have a lot of results.

6
00:00:17,140 --> 00:00:19,070
‫So let's pretend that we have, for example,

7
00:00:19,070 --> 00:00:21,720
‫1000 documents in a certain collection.

8
00:00:21,720 --> 00:00:25,160
‫And we say that on each page we have 100 documents.

9
00:00:25,160 --> 00:00:28,230
‫So that would mean that we'd have 10 pages, right?

10
00:00:28,230 --> 00:00:31,210
‫So 10 times 100 is 1000.

11
00:00:31,210 --> 00:00:34,430
‫And so based on that, how are we gonna implement pagination

12
00:00:34,430 --> 00:00:36,460
‫using or query string?

13
00:00:36,460 --> 00:00:40,003
‫Well, we will use the page and delimit fields.

14
00:00:41,460 --> 00:00:44,810
‫So there will be a page field.

15
00:00:44,810 --> 00:00:47,230
‫Let's say we want page two

16
00:00:47,230 --> 00:00:49,053
‫and there will be a limit field.

17
00:00:50,760 --> 00:00:53,580
‫And this limit here basically means the amount

18
00:00:53,580 --> 00:00:56,090
‫of results that we want per page.

19
00:00:56,090 --> 00:00:59,090
‫And that's actually setted here only to 10

20
00:00:59,090 --> 00:01:01,610
‫and of course we have to correct this one here.

21
00:01:01,610 --> 00:01:03,910
‫It's not a comma, but an and.

22
00:01:03,910 --> 00:01:06,690
‫So page two and the limit 10.

23
00:01:06,690 --> 00:01:09,930
‫Now going back to the example of 1000 results,

24
00:01:09,930 --> 00:01:13,380
‫if the limit is 10, so only 10 results per page,

25
00:01:13,380 --> 00:01:15,670
‫well then we're gonna have 100 pages

26
00:01:15,670 --> 00:01:18,800
‫and in here we are then displaying page number 2

27
00:01:18,800 --> 00:01:20,780
‫of these 100 pages.

28
00:01:20,780 --> 00:01:21,880
‫Okay?

29
00:01:21,880 --> 00:01:26,600
‫Now, we need now a way of implementing this using Mongoose.

30
00:01:26,600 --> 00:01:29,820
‫So let's take a look at how we could do that

31
00:01:29,820 --> 00:01:31,653
‫by going back to our code.

32
00:01:33,790 --> 00:01:35,313
‫So feature number four,

33
00:01:36,970 --> 00:01:37,913
‫Pagination.

34
00:01:39,530 --> 00:01:40,363
‫All right,

35
00:01:40,363 --> 00:01:42,810
‫And I will start by building an example query here

36
00:01:42,810 --> 00:01:44,880
‫just like we did before.

37
00:01:44,880 --> 00:01:48,930
‫So let's say that the query is equal query.

38
00:01:48,930 --> 00:01:51,200
‫And now what kind of methods do we have

39
00:01:51,200 --> 00:01:53,270
‫in order to implement pagination?

40
00:01:53,270 --> 00:01:55,770
‫Well, the most useful one is skip

41
00:01:56,810 --> 00:01:59,570
‫and I'm gonna explain what it does in a second,

42
00:01:59,570 --> 00:02:01,510
‫so let's just put a random number here.

43
00:02:01,510 --> 00:02:03,913
‫So skip and limit,

44
00:02:05,830 --> 00:02:07,070
‫and let's put 10.

45
00:02:07,070 --> 00:02:10,150
‫and so this limit here is actually exactly the same

46
00:02:10,150 --> 00:02:12,670
‫as the limit that we defined in the query string.

47
00:02:12,670 --> 00:02:14,970
‫So basically the amount of results

48
00:02:14,970 --> 00:02:16,810
‫that we want in the query.

49
00:02:16,810 --> 00:02:20,710
‫And then skip, that we have here, is the amount of results

50
00:02:20,710 --> 00:02:24,490
‫that should be skipped before actually querying data.

51
00:02:24,490 --> 00:02:27,836
‫All right, so again, this is just a placeholder here.

52
00:02:27,836 --> 00:02:30,573
‫Let's go back to this example that we have here.

53
00:02:31,550 --> 00:02:34,193
‫I'm just gonna copy this query string here.

54
00:02:36,279 --> 00:02:39,790
‫so let's say that the user wants page number two

55
00:02:39,790 --> 00:02:42,600
‫with 10 results per page.

56
00:02:42,600 --> 00:02:46,320
‫That means that results one to 10 are on page one,

57
00:02:46,320 --> 00:02:49,090
‫and 11 to 20 are on page 2.

58
00:02:49,090 --> 00:02:52,660
‫Okay, and so what that means is that we want to skip

59
00:02:52,660 --> 00:02:55,720
‫10 results before we actually start querying.

60
00:02:55,720 --> 00:02:56,750
‫Okay.

61
00:02:56,750 --> 00:02:59,030
‫So again, one to 10

62
00:03:00,840 --> 00:03:02,430
‫are for page one

63
00:03:02,430 --> 00:03:04,770
‫and then 11 to 20

64
00:03:07,230 --> 00:03:08,390
‫are for page two,

65
00:03:08,390 --> 00:03:09,580
‫and so on and so forth.

66
00:03:09,580 --> 00:03:13,303
‫So 21 to 30 will be page three,

67
00:03:14,400 --> 00:03:15,920
‫And so on and so forth.

68
00:03:15,920 --> 00:03:17,950
‫And so we need to skip 10 results

69
00:03:17,950 --> 00:03:21,590
‫in order to get to result number 11, right?

70
00:03:21,590 --> 00:03:26,590
‫So to result number 11 which will the first one on page two.

71
00:03:26,640 --> 00:03:30,230
‫Okay, and since it is page two that was requested,

72
00:03:30,230 --> 00:03:33,050
‫well, again we need to skip 10 results

73
00:03:33,050 --> 00:03:35,380
‫before we actually start page two.

74
00:03:35,380 --> 00:03:37,450
‫Okay? Make sense?

75
00:03:37,450 --> 00:03:41,060
‫And for example, if we requested page number three,

76
00:03:41,060 --> 00:03:43,380
‫well then of course, 20 results would

77
00:03:43,380 --> 00:03:45,400
‫first have to be skipped.

78
00:03:45,400 --> 00:03:46,840
‫And so we will need some way

79
00:03:46,840 --> 00:03:49,680
‫of calculating this skip value here.

80
00:03:49,680 --> 00:03:52,750
‫So based basically on the page and the limit.

81
00:03:52,750 --> 00:03:55,700
‫Now you might ask why I do not directly ask for the

82
00:03:55,700 --> 00:03:57,690
‫skip value in the query string,

83
00:03:57,690 --> 00:04:00,370
‫but that's because for the user this value here is

84
00:04:00,370 --> 00:04:01,980
‫kind of abstract, okay?

85
00:04:01,980 --> 00:04:05,537
‫It's way easier to simply say, "Well I want page number one,

86
00:04:05,537 --> 00:04:06,967
‫"or I want page number five

87
00:04:06,967 --> 00:04:09,050
‫"or I want like page number 10."

88
00:04:09,050 --> 00:04:12,520
‫Okay, so for the user it's much easier

89
00:04:12,520 --> 00:04:14,983
‫to not deal with skip values here

90
00:04:14,983 --> 00:04:18,100
‫and all that stuff, the user wants to have it easy

91
00:04:18,100 --> 00:04:20,500
‫and to just define a page.

92
00:04:20,500 --> 00:04:22,540
‫Now before we can actually get started

93
00:04:22,540 --> 00:04:26,420
‫calculating the skip value, we need to first get the page

94
00:04:26,420 --> 00:04:28,840
‫and the limit from the query string

95
00:04:28,840 --> 00:04:31,700
‫and we should also define some default values.

96
00:04:31,700 --> 00:04:33,550
‫Okay, so that's basically

97
00:04:33,550 --> 00:04:35,910
‫because we still want to have pagination

98
00:04:35,910 --> 00:04:38,560
‫even if the user does not specify any page

99
00:04:38,560 --> 00:04:40,040
‫or any limit.

100
00:04:40,040 --> 00:04:43,130
‫Because for example let's say that we have a million results

101
00:04:43,130 --> 00:04:44,900
‫in our database,

102
00:04:44,900 --> 00:04:47,750
‫and then of course when the user does the request

103
00:04:47,750 --> 00:04:51,820
‫we would not simply show all of these 10 million results.

104
00:04:51,820 --> 00:04:54,860
‫That wouldn't be very user friendly, would it?

105
00:04:54,860 --> 00:04:58,610
‫And so, I will define by default page number one

106
00:04:58,610 --> 00:05:01,500
‫and a limit of let's say 100.

107
00:05:01,500 --> 00:05:05,100
‫So that by default when a user requests all of the tours

108
00:05:05,100 --> 00:05:08,070
‫in this example, then he only gets 100,

109
00:05:08,070 --> 00:05:10,273
‫and not a million, all right?

110
00:05:11,470 --> 00:05:16,427
‫So the page is of course request.query.page

111
00:05:18,290 --> 00:05:20,890
‫and I'm now going to multiply it by one

112
00:05:20,890 --> 00:05:23,120
‫which is just a nice trick to convert

113
00:05:23,120 --> 00:05:24,830
‫a string to a number.

114
00:05:24,830 --> 00:05:28,370
‫Okay, so maybe you noticed before that each time that we

115
00:05:28,370 --> 00:05:30,600
‫actually put a number in a query string,

116
00:05:30,600 --> 00:05:33,730
‫it will then be a string or a query object,

117
00:05:33,730 --> 00:05:37,410
‫and so we need to fix that simply by multiplying by one.

118
00:05:37,410 --> 00:05:41,760
‫Okay, and then by default, we want page number one.

119
00:05:41,760 --> 00:05:42,593
‫All right?

120
00:05:42,593 --> 00:05:44,750
‫And so this is a nice way in JavaScript

121
00:05:44,750 --> 00:05:47,690
‫of basically defining default values.

122
00:05:47,690 --> 00:05:50,463
‫And I'm sure you're familiar with that, right?

123
00:05:51,310 --> 00:05:56,310
‫Anyway, the limit is on req.query.limit

124
00:05:58,370 --> 00:06:00,610
‫times one again to convert it,

125
00:06:00,610 --> 00:06:04,300
‫or the default of 100 that we just mentioned.

126
00:06:04,300 --> 00:06:08,240
‫So ideally the user will only specify the page number

127
00:06:08,240 --> 00:06:09,570
‫that he requests

128
00:06:09,570 --> 00:06:12,010
‫and to not even bother with the page limit.

129
00:06:12,010 --> 00:06:14,370
‫That's for more specific use cases.

130
00:06:14,370 --> 00:06:19,060
‫Okay, and now all we need to do is to then define

131
00:06:19,060 --> 00:06:20,420
‫so to calculate basically

132
00:06:21,450 --> 00:06:25,130
‫that skip value that we just talked about here before.

133
00:06:25,130 --> 00:06:28,470
‫And the best way of doing that is to go back to an example.

134
00:06:28,470 --> 00:06:31,940
‫So again, let's say we are requesting page number three,

135
00:06:31,940 --> 00:06:33,610
‫with the limit of 10.

136
00:06:33,610 --> 00:06:37,140
‫and we see here for page number three the results are

137
00:06:37,140 --> 00:06:38,900
‫from 21 to 30.

138
00:06:38,900 --> 00:06:42,340
‫So it starts at result number 21, meaning that we need to

139
00:06:42,340 --> 00:06:44,110
‫skip 20 results.

140
00:06:44,110 --> 00:06:47,140
‫And 20 results is basically two times 10,

141
00:06:47,140 --> 00:06:49,510
‫so two times this limit.

142
00:06:49,510 --> 00:06:52,700
‫Okay, and from there we actually start getting a formula.

143
00:06:52,700 --> 00:06:57,140
‫So two times ten is basically three minus one times 10.

144
00:06:57,140 --> 00:06:59,293
‫And three is the page that we're on.

145
00:07:00,161 --> 00:07:01,760
‫So that is our formula.

146
00:07:01,760 --> 00:07:03,780
‫So page minus one

147
00:07:03,780 --> 00:07:05,693
‫and so the previous page, basically,

148
00:07:06,690 --> 00:07:07,523
‫times

149
00:07:08,750 --> 00:07:09,583
‫the limit.

150
00:07:10,960 --> 00:07:13,733
‫Okay, so I hope that made sense,

151
00:07:14,630 --> 00:07:17,273
‫let's now replace these values here.

152
00:07:18,330 --> 00:07:19,163
‫Skip

153
00:07:20,420 --> 00:07:22,193
‫and limit of limit.

154
00:07:23,610 --> 00:07:24,550
‫Okay?

155
00:07:24,550 --> 00:07:27,900
‫So basically, this number here is all the results that

156
00:07:27,900 --> 00:07:31,230
‫come before the page that we're actually requesting now.

157
00:07:31,230 --> 00:07:34,330
‫So again, if we are requesting page number three

158
00:07:34,330 --> 00:07:37,280
‫our results are gonna start at page number 21.

159
00:07:37,280 --> 00:07:40,020
‫And so we wanna skip 20 results before that.

160
00:07:40,020 --> 00:07:41,490
‫And so 20 results is

161
00:07:41,490 --> 00:07:44,683
‫because we have 2 pages time 10 results on each,

162
00:07:45,940 --> 00:07:49,350
‫Yeah, it's gonna be the page that we just requested.

163
00:07:49,350 --> 00:07:51,450
‫So page here, minus one,

164
00:07:51,450 --> 00:07:54,260
‫so the previous page times the number of results

165
00:07:54,260 --> 00:07:55,103
‫on each page.

166
00:07:56,050 --> 00:07:58,870
‫Okay, so that's the amount of documents that

167
00:07:58,870 --> 00:08:00,133
‫are gonna be skipped.

168
00:08:01,772 --> 00:08:03,630
‫Okay, so I hope that made sense.

169
00:08:03,630 --> 00:08:06,520
‫Let's now go ahead and actually try this.

170
00:08:06,520 --> 00:08:09,460
‫And since we only have so few results here

171
00:08:09,460 --> 00:08:12,093
‫we need to test it with a really small limit.

172
00:08:13,260 --> 00:08:17,440
‫So let's say that we only want three results per page,

173
00:08:17,440 --> 00:08:19,640
‫and let's actually start on page number one.

174
00:08:22,280 --> 00:08:25,240
‫So send it, and indeed now we only get

175
00:08:25,240 --> 00:08:27,463
‫three results as you can see here.

176
00:08:28,880 --> 00:08:30,630
‫So these three, let's see.

177
00:08:30,630 --> 00:08:32,030
‫So The Forest Hiker,

178
00:08:32,030 --> 00:08:33,320
‫The Sea Explorer,

179
00:08:33,320 --> 00:08:34,473
‫and The City Wanderer.

180
00:08:35,550 --> 00:08:36,630
‫Okay?

181
00:08:36,630 --> 00:08:38,900
‫Let's try page number two,

182
00:08:38,900 --> 00:08:41,700
‫and for some reason the postman keeps jumping around

183
00:08:41,700 --> 00:08:44,393
‫each time that I change the URL.

184
00:08:45,900 --> 00:08:47,940
‫Anyway, now we have The Park Camper,

185
00:08:47,940 --> 00:08:49,250
‫The Snow Adventurer,

186
00:08:49,250 --> 00:08:50,810
‫and The Sports Lover.

187
00:08:50,810 --> 00:08:52,920
‫So you start seeing that we actually

188
00:08:52,920 --> 00:08:55,130
‫now have different tours.

189
00:08:55,130 --> 00:08:55,963
‫Okay?

190
00:08:55,963 --> 00:08:59,467
‫And so we can kind of say that

191
00:08:59,467 --> 00:09:01,683
‫our pagination here is already working.

192
00:09:03,550 --> 00:09:05,120
‫Now the last page,

193
00:09:05,120 --> 00:09:07,630
‫and we have now The Northern Lights,

194
00:09:07,630 --> 00:09:08,860
‫The Wine Taster,

195
00:09:08,860 --> 00:09:10,780
‫and The Star Gazer.

196
00:09:10,780 --> 00:09:12,100
‫All right?

197
00:09:12,100 --> 00:09:16,380
‫Now what if we try to go to page number four?

198
00:09:16,380 --> 00:09:19,020
‫We already know that we only have nine tours,

199
00:09:19,020 --> 00:09:22,820
‫and so on page number four there should be nothing.

200
00:09:22,820 --> 00:09:23,653
‫Right?

201
00:09:23,653 --> 00:09:25,040
‫So let's test that.

202
00:09:25,040 --> 00:09:27,600
‫And indeed we get zero results.

203
00:09:27,600 --> 00:09:30,163
‫But that is of course not ideal.

204
00:09:31,010 --> 00:09:34,130
‫Okay, and so let's now go ahead and fix that

205
00:09:34,130 --> 00:09:37,207
‫and basically kind of throw an error each time

206
00:09:37,207 --> 00:09:40,050
‫the user selects a page that does not exist.

207
00:09:40,050 --> 00:09:42,320
‫Because that's basically the situation here.

208
00:09:42,320 --> 00:09:45,600
‫The user requested a page that simply does not exist.

209
00:09:45,600 --> 00:09:49,660
‫We don't have enough results to have four pages

210
00:09:49,660 --> 00:09:50,733
‫with three results.

211
00:09:53,120 --> 00:09:55,560
‫Let's now do that,

212
00:09:55,560 --> 00:09:57,130
‫and this will actually only happen

213
00:09:57,130 --> 00:10:00,020
‫when there is a page on the query

214
00:10:00,020 --> 00:10:03,880
‫and so let's actually create this if statement here.

215
00:10:03,880 --> 00:10:08,880
‫So if request.query.page,

216
00:10:10,920 --> 00:10:13,960
‫only in this case we will test if we are skipping more

217
00:10:13,960 --> 00:10:16,560
‫tours than we actually have.

218
00:10:16,560 --> 00:10:18,610
‫So let's get the amount of tours.

219
00:10:18,610 --> 00:10:22,830
‫So number of tours is equal to,

220
00:10:22,830 --> 00:10:25,403
‫and now we're actually going to learn a new method.

221
00:10:26,610 --> 00:10:28,780
‫So a new method there is on the Tour model

222
00:10:28,780 --> 00:10:30,953
‫which is called countDocuments.

223
00:10:34,600 --> 00:10:37,840
‫Okay? And as the name says this is going to return

224
00:10:37,840 --> 00:10:40,533
‫the number of documents, all right?

225
00:10:40,533 --> 00:10:42,600
‫Actually it's gonna return a promise

226
00:10:42,600 --> 00:10:44,410
‫but we then await the promise

227
00:10:44,410 --> 00:10:45,980
‫and so it will then come back

228
00:10:45,980 --> 00:10:48,133
‫with the result of the amount of tours.

229
00:10:49,064 --> 00:10:53,810
‫Okay? And so if the number of documents that we skip

230
00:10:53,810 --> 00:10:57,550
‫is greater than the number of documents that actually exists

231
00:10:57,550 --> 00:11:01,720
‫well then that means that the page does not exist, alright?

232
00:11:01,720 --> 00:11:02,553
‫That make sense?

233
00:11:04,720 --> 00:11:07,600
‫So if skip is greater

234
00:11:07,600 --> 00:11:09,360
‫than the number of tours,

235
00:11:09,360 --> 00:11:12,493
‫and for now what I'm gonna do here is to throw a new error.

236
00:11:14,060 --> 00:11:14,893
‫Okay?

237
00:11:14,893 --> 00:11:16,380
‫So throw new error

238
00:11:18,490 --> 00:11:21,253
‫this page does not exist.

239
00:11:23,260 --> 00:11:25,970
‫Now why am I throwing an error here?

240
00:11:25,970 --> 00:11:29,120
‫Well, simply because if I throw an error here

241
00:11:29,120 --> 00:11:32,560
‫in the triblock which we are currently in,

242
00:11:32,560 --> 00:11:33,830
‫it will then automatically

243
00:11:33,830 --> 00:11:37,180
‫and immediately move on to the catch block,

244
00:11:37,180 --> 00:11:42,180
‫and it will then send back this 404 kind of fail message.

245
00:11:42,610 --> 00:11:43,830
‫Okay?

246
00:11:43,830 --> 00:11:46,470
‫And so that's what we want for now.

247
00:11:46,470 --> 00:11:49,440
‫Just keep in mind that we will implement much better

248
00:11:49,440 --> 00:11:51,510
‫error handling a bit later in the course.

249
00:11:51,510 --> 00:11:55,010
‫And actually right in the next section, okay?

250
00:11:55,010 --> 00:11:56,820
‫But for now let's just keep it simple,

251
00:11:56,820 --> 00:11:58,390
‫throw this error here

252
00:11:58,390 --> 00:12:00,880
‫in case that we're trying to skip more documents

253
00:12:00,880 --> 00:12:01,980
‫than we actually have.

254
00:12:02,830 --> 00:12:03,663
‫Okay?

255
00:12:04,620 --> 00:12:08,070
‫So this is the right case, let's send it here

256
00:12:08,070 --> 00:12:11,350
‫and that's not the result that I expected

257
00:12:11,350 --> 00:12:13,150
‫so let's go back

258
00:12:13,150 --> 00:12:15,590
‫so right now our page is four

259
00:12:15,590 --> 00:12:17,670
‫and the limit is three.

260
00:12:17,670 --> 00:12:21,730
‫So the skip here would be three time three, so nine, okay?

261
00:12:21,730 --> 00:12:24,010
‫And the number of tours is nine as well

262
00:12:24,010 --> 00:12:26,890
‫and so skip is not greater than the number of tours

263
00:12:26,890 --> 00:12:28,840
‫and therefore we don't get this error.

264
00:12:28,840 --> 00:12:32,910
‫So what we need to do is to set it to greater or equal.

265
00:12:32,910 --> 00:12:35,423
‫Okay, and so that should now work.

266
00:12:36,350 --> 00:12:38,610
‫And that takes a long time,

267
00:12:38,610 --> 00:12:39,443
‫and it did.

268
00:12:39,443 --> 00:12:42,290
‫Now we get the fail status here

269
00:12:42,290 --> 00:12:43,470
‫and a 404.

270
00:12:43,470 --> 00:12:44,303
‫For some reason

271
00:12:45,170 --> 00:12:47,640
‫this error is not showing up here

272
00:12:47,640 --> 00:12:49,113
‫which it actually should.

273
00:12:50,360 --> 00:12:54,500
‫But don't worry about that, that's not really important.

274
00:12:54,500 --> 00:12:58,010
‫What matters is that it did actually enter our catch block,

275
00:12:58,010 --> 00:13:00,810
‫and then send back this 404 response.

276
00:13:00,810 --> 00:13:03,490
‫Everything else we're gonna implement a bit later.

277
00:13:03,490 --> 00:13:05,660
‫Okay, and that's actually it.

278
00:13:05,660 --> 00:13:09,140
‫So that's all the methods that we're gonna add to our query,

279
00:13:09,140 --> 00:13:12,727
‫and so when we finally reach the next line of code here,

280
00:13:12,727 --> 00:13:14,740
‫our query will then be awaited,

281
00:13:14,740 --> 00:13:17,440
‫and return with the tours.

282
00:13:17,440 --> 00:13:21,365
‫Okay, and at this point our query might actually look

283
00:13:21,365 --> 00:13:22,770
‫something like

284
00:13:24,350 --> 00:13:26,600
‫so something like this, something like

285
00:13:26,600 --> 00:13:27,850
‫well what do we have here

286
00:13:28,860 --> 00:13:31,433
‫we have sort, select,

287
00:13:32,630 --> 00:13:34,020
‫so we might have sort,

288
00:13:34,020 --> 00:13:36,070
‫and then some select there

289
00:13:36,070 --> 00:13:38,270
‫we have also

290
00:13:38,270 --> 00:13:39,600
‫skip

291
00:13:39,600 --> 00:13:41,803
‫we have limit as well,

292
00:13:43,170 --> 00:13:46,270
‫and so that's really kind of a big query.

293
00:13:46,270 --> 00:13:48,650
‫And again, what allows us to that that is

294
00:13:48,650 --> 00:13:51,680
‫that each of these methods here will always return

295
00:13:51,680 --> 00:13:54,610
‫a new query that we can then chain on the next method

296
00:13:54,610 --> 00:13:55,570
‫and the next method,

297
00:13:55,570 --> 00:13:59,330
‫and the next method until we finally await the query

298
00:13:59,330 --> 00:14:02,890
‫so that it can actually give us our documents.

299
00:14:02,890 --> 00:14:06,110
‫Okay, so let's get rid of all these comments

300
00:14:06,110 --> 00:14:08,500
‫and yeah, that's it for now.

301
00:14:08,500 --> 00:14:10,850
‫For these features we're just gonna add one more

302
00:14:10,850 --> 00:14:12,220
‫in the next lecture,

303
00:14:12,220 --> 00:14:14,570
‫but that one is gonna be a bit different than these.

304
00:14:14,570 --> 00:14:18,090
‫It's not gonna use one of these query methods, all right?

305
00:14:18,090 --> 00:14:20,470
‫So I hope that over the last couple of lectures

306
00:14:20,470 --> 00:14:22,230
‫you really learned the ins and outs

307
00:14:22,230 --> 00:14:24,530
‫of querying data with Mongoose.

308
00:14:24,530 --> 00:14:27,540
‫So of course, all of these methods that we used are not

309
00:14:27,540 --> 00:14:30,640
‫only useful for these features that we implemented here.

310
00:14:30,640 --> 00:14:32,760
‫You can really create all kinds of querys

311
00:14:32,760 --> 00:14:36,200
‫that you can imagine for all kinds of applications.

312
00:14:36,200 --> 00:14:38,890
‫So I showed you all the techniques here in this context

313
00:14:38,890 --> 00:14:41,090
‫of these different API features,

314
00:14:41,090 --> 00:14:43,000
‫but of course you're gonna be able to use them

315
00:14:43,000 --> 00:14:46,520
‫all over your applications in the future, okay?

316
00:14:46,520 --> 00:14:48,780
‫So I hope that was fun for you

317
00:14:48,780 --> 00:14:53,510
‫and if it was, then let's move on now right to the next one.

318
00:14:53,510 --> 00:14:54,343
‫See you!

