Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,150 --> 00:00:03,650
Hey, there. So in this video we're gonna keep
2
00:00:03,650 --> 00:00:06,670
working with the aggregation pipeline.
3
00:00:06,670 --> 00:00:09,540
And I really love this video because
4
00:00:09,540 --> 00:00:13,083
in this one we're gonna solve a real business problem.
5
00:00:14,570 --> 00:00:17,220
So let's imagine that we are really developing
6
00:00:17,220 --> 00:00:19,730
this application for the Nature's Company.
7
00:00:19,730 --> 00:00:21,780
And so let's say that they ask us
8
00:00:21,780 --> 00:00:24,090
to implement a function to calculate
9
00:00:24,090 --> 00:00:26,720
the busiest month of a given year.
10
00:00:26,720 --> 00:00:29,538
So basically by calculating how many tours
11
00:00:29,538 --> 00:00:33,400
start in each of the month of the given year.
12
00:00:33,400 --> 00:00:35,350
And the company really needs this fine tune
13
00:00:35,350 --> 00:00:37,920
to prepare accordingly for these tours,
14
00:00:37,920 --> 00:00:40,930
like to hire tour guides or to buy the equipment
15
00:00:40,930 --> 00:00:42,850
and handle all the stuff like that.
16
00:00:42,850 --> 00:00:44,850
So this is a real business problem
17
00:00:44,850 --> 00:00:46,301
that we now can solve
18
00:00:46,301 --> 00:00:49,550
using aggregation pipelines. Okay?
19
00:00:49,550 --> 00:00:52,110
And so, this is gonna be a real challenge
20
00:00:52,110 --> 00:00:54,570
and I-- I hope it's gonna be really fun
21
00:00:54,570 --> 00:00:58,030
to solve this kind of real business need.
22
00:00:58,030 --> 00:01:01,443
At least if Nature's was a real business, I guess.
23
00:01:02,730 --> 00:01:05,810
So, let's start by
24
00:01:05,810 --> 00:01:08,990
again creating the function.
25
00:01:08,990 --> 00:01:12,463
So export dot and I'm gonna call it:
26
00:01:13,700 --> 00:01:15,583
get monthly plan.
27
00:01:17,520 --> 00:01:18,353
All right.
28
00:01:18,353 --> 00:01:21,030
And again it's gonna be a-- an async function
29
00:01:23,060 --> 00:01:27,810
method, request response or try cache block
30
00:01:33,820 --> 00:01:36,010
and I could actually just have gone and copied it
31
00:01:36,010 --> 00:01:37,483
from up here.
32
00:01:38,600 --> 00:01:41,480
But, nevermind. All right.
33
00:01:41,480 --> 00:01:46,250
And uh now let's actually also uh implement the
34
00:01:46,250 --> 00:01:47,723
route uh right here.
35
00:01:48,628 --> 00:01:50,528
And I'm just gonna duplicate this line
36
00:01:53,200 --> 00:01:55,390
so monthly plan...
37
00:01:56,650 --> 00:01:59,020
And then here this one is called:
38
00:01:59,020 --> 00:02:02,610
get monthly plan. And actually we wanna be able
39
00:02:02,610 --> 00:02:06,553
to pass a year in the URL. And so let's use
40
00:02:06,553 --> 00:02:11,113
a URL parameter for that. All right.
41
00:02:12,360 --> 00:02:14,500
So uh...
42
00:02:14,500 --> 00:02:16,950
coming back here let's start by
43
00:02:16,950 --> 00:02:18,930
uh defining the year.
44
00:02:18,930 --> 00:02:23,930
So the year is coming from req dot params dot year.
45
00:02:24,660 --> 00:02:26,300
Remember that
46
00:02:26,300 --> 00:02:28,960
and then again that trick to transform it
47
00:02:28,960 --> 00:02:31,083
into a number. Okay?
48
00:02:31,930 --> 00:02:34,820
Then I'm gonna create the plan variable
49
00:02:35,840 --> 00:02:40,220
which is gonna await tour dot aggregate.
50
00:02:40,220 --> 00:02:42,950
So just like before and for now
51
00:02:42,950 --> 00:02:45,400
I'm gonna leave it empty here.
52
00:02:45,400 --> 00:02:47,440
And I will copy this piece of code
53
00:02:47,440 --> 00:02:49,103
to then send the results.
54
00:02:51,800 --> 00:02:55,900
And this one is called plan and all right.
55
00:02:55,900 --> 00:02:59,340
So now we're ready to start our aggregation pipeline
56
00:02:59,340 --> 00:03:01,990
just like we did in the last video.
57
00:03:01,990 --> 00:03:04,260
Now to start, let's actually take a look
58
00:03:04,260 --> 00:03:05,761
at the complete results.
59
00:03:05,761 --> 00:03:07,922
Just so we can get a better idea
60
00:03:07,922 --> 00:03:10,123
of what we actually need to build here.
61
00:03:12,410 --> 00:03:16,290
So let's do get all tours and get completely rid
62
00:03:17,200 --> 00:03:19,313
of this query string.
63
00:03:20,720 --> 00:03:23,030
And so here we have all nine tours
64
00:03:23,030 --> 00:03:25,930
and each of the tours, remember, has an array
65
00:03:25,930 --> 00:03:28,120
of these start dates.
66
00:03:28,120 --> 00:03:32,830
So one tour will start on April 25th, 2021.
67
00:03:32,830 --> 00:03:37,090
Then the next one starts on July 20th
68
00:03:37,090 --> 00:03:39,870
and then October 5th. All right.
69
00:03:39,870 --> 00:03:43,140
Then uh the next one has this start date
70
00:03:43,140 --> 00:03:46,520
and all of them I believe have three starting dates.
71
00:03:46,520 --> 00:03:50,670
Okay? So, these dates is what we actually need
72
00:03:50,670 --> 00:03:54,160
as a starting point to create this function
73
00:03:54,160 --> 00:03:56,790
or to create this aggregation pipeline.
74
00:03:56,790 --> 00:04:00,480
Because remember, we want to count how many tours there are
75
00:04:00,480 --> 00:04:02,960
for each of the months in a given year.
76
00:04:02,960 --> 00:04:07,110
And so let's so that we're analyzing 2021, okay?
77
00:04:07,110 --> 00:04:11,130
We have one tour in April, one in July, one in October.
78
00:04:11,130 --> 00:04:13,840
Then let's take a look at the next tour.
79
00:04:13,840 --> 00:04:18,230
Here we have one in June, one in July, and one in August.
80
00:04:18,230 --> 00:04:20,170
So in July we already have two.
81
00:04:20,170 --> 00:04:22,890
So this one and this one.
82
00:04:22,890 --> 00:04:26,780
Next one we have uh, one in March, one in May,
83
00:04:26,780 --> 00:04:29,963
and one in June. So in June we also already have two.
84
00:04:30,940 --> 00:04:34,390
Okay? And so we can keep going and doing it manually
85
00:04:34,390 --> 00:04:37,920
but of course we want to do it with our aggregation.
86
00:04:37,920 --> 00:04:40,360
So if you want to add all of this together
87
00:04:40,360 --> 00:04:44,030
the easiest way would basically be to have one tour
88
00:04:44,030 --> 00:04:47,550
for each of these dates here, right?
89
00:04:47,550 --> 00:04:50,660
And we can actually do that using the aggregation pipeline.
90
00:04:50,660 --> 00:04:53,460
There is a stage for doing exactly that.
91
00:04:53,460 --> 00:04:56,060
And that is called unwind.
92
00:04:56,060 --> 00:04:58,320
So let's use it now and I will then show you
93
00:04:58,320 --> 00:05:02,023
uh-- the result of it and why we really need it.
94
00:05:02,970 --> 00:05:05,796
Okay? So, again we define an object
95
00:05:05,796 --> 00:05:08,400
and then the name of the stage.
96
00:05:08,400 --> 00:05:12,280
And in this case it is: unwind. Okay?
97
00:05:12,280 --> 00:05:15,940
And what unwind is gonna do is basically deconstruct
98
00:05:15,940 --> 00:05:18,132
an array field from the info documents
99
00:05:18,132 --> 00:05:22,680
and then output one document for each element of the array.
100
00:05:22,680 --> 00:05:24,670
And so that's what I was saying before.
101
00:05:24,670 --> 00:05:27,310
Which is, that basically we want to have one tour
102
00:05:27,310 --> 00:05:31,270
for each of these dates in the array. Okay?
103
00:05:31,270 --> 00:05:35,713
And this stage can be really useful for so many cases.
104
00:05:38,490 --> 00:05:41,640
So, the field with the array that we want to unwind
105
00:05:41,640 --> 00:05:43,410
is start dates.
106
00:05:43,410 --> 00:05:45,970
All right and so for now that's actually all.
107
00:05:45,970 --> 00:05:49,210
So I just want to show you the result of that right now.
108
00:05:49,210 --> 00:05:52,170
And I think we already actually have everything in place
109
00:05:52,170 --> 00:05:55,270
for this to work. So just keep in mind
110
00:05:55,270 --> 00:05:58,862
that the route is called monthly plan and then with a year.
111
00:05:58,862 --> 00:06:01,280
Which for now it's not gonna have any results
112
00:06:02,600 --> 00:06:05,243
but um, we have to define it anyway.
113
00:06:10,100 --> 00:06:15,030
So monthly plan and the year of 2021.
114
00:06:15,030 --> 00:06:16,363
So let's send this now.
115
00:06:17,580 --> 00:06:21,250
And indeed we now have uh this start date
116
00:06:21,250 --> 00:06:24,740
no longer as an array but only this first element
117
00:06:24,740 --> 00:06:26,660
of the array that we had before.
118
00:06:26,660 --> 00:06:30,550
Let's put them side-by-side. And so you see, we had
119
00:06:30,550 --> 00:06:32,580
or actually let's do it with the first one.
120
00:06:32,580 --> 00:06:35,963
So we had the first taker for April 25th,
121
00:06:36,880 --> 00:06:40,150
July 20th, and October 5th.
122
00:06:40,150 --> 00:06:45,150
And so now we have the first hiker on this date here,
123
00:06:45,490 --> 00:06:49,640
then we have the first hiker on uh, July 20,
124
00:06:49,640 --> 00:06:53,960
and now we will have the first hiker for October 5th.
125
00:06:53,960 --> 00:06:56,170
So, exactly the result that we wanted
126
00:06:56,170 --> 00:06:59,861
because now we have one document for each of the dates.
127
00:06:59,861 --> 00:07:04,300
Okay? So instead of having nine, we now have 27
128
00:07:04,300 --> 00:07:07,443
which is nine times three. All right.
129
00:07:08,300 --> 00:07:11,570
So, that's the first date. Now let's actually go ahead
130
00:07:11,570 --> 00:07:15,233
and select the documents for the year that was passed in.
131
00:07:16,590 --> 00:07:20,225
Okay? And remember which stage we use for that
132
00:07:20,225 --> 00:07:23,800
that's right, we use match.
133
00:07:23,800 --> 00:07:28,160
So remember, match is basically to select documents.
134
00:07:28,160 --> 00:07:29,870
So just to do a query.
135
00:07:29,870 --> 00:07:33,190
And so the year is in the start dates.
136
00:07:33,190 --> 00:07:36,023
So start dates is the one that we're gonna search for.
137
00:07:37,180 --> 00:07:41,420
So start dates, and now what do we want?
138
00:07:41,420 --> 00:07:45,750
Well we want the--the date basically to be greater
139
00:07:45,750 --> 00:07:48,150
than January 1st of the current year,
140
00:07:48,150 --> 00:07:51,740
so let's say 2021. And we want it to be less
141
00:07:51,740 --> 00:07:55,200
than January 1st of 2022, all right.
142
00:07:55,200 --> 00:07:59,520
So basically we want it to be 2020 and 2022. All right?
143
00:08:01,350 --> 00:08:03,130
So let's put that in code now.
144
00:08:03,130 --> 00:08:05,970
So start dates and then we need another object
145
00:08:05,970 --> 00:08:10,687
for the operators. So, greater or equal than
146
00:08:10,687 --> 00:08:14,930
and in MongoDB this works perfectly fine with dates.
147
00:08:14,930 --> 00:08:18,330
So Mongo is actually perfect for working with dates like
148
00:08:18,330 --> 00:08:22,350
doing date comparisons. So it works really great.
149
00:08:22,350 --> 00:08:25,774
So now we actually need to define a new date here
150
00:08:25,774 --> 00:08:29,580
so that, that one can then be compared with the date
151
00:08:29,580 --> 00:08:31,290
that's in each of the documents.
152
00:08:31,290 --> 00:08:34,909
So the formula of the date is year, month, and date.
153
00:08:34,909 --> 00:08:37,250
And so let's do a template string here
154
00:08:38,919 --> 00:08:41,092
and use our year variable.
155
00:08:43,826 --> 00:08:46,100
So January 1st.
156
00:08:46,100 --> 00:08:49,050
So, we want our date to be greater or equal than
157
00:08:49,050 --> 00:08:54,050
January 1st, 2021 and let's actually write that here
158
00:08:54,620 --> 00:08:58,540
just to keep it in mind. And we want it to be less
159
00:09:00,260 --> 00:09:03,763
less than, or we can say less than, equal.
160
00:09:05,150 --> 00:09:10,150
Let's go ahead and copy this one and then
161
00:09:10,160 --> 00:09:15,160
December 31st. Okay? So, basically we want it to be between
162
00:09:15,980 --> 00:09:18,520
the first day of the year and the last day
163
00:09:18,520 --> 00:09:20,853
of the current year. Okay?
164
00:09:22,310 --> 00:09:25,060
So let's keep testing it, so I will test it now
165
00:09:25,060 --> 00:09:28,640
after each of the stages. So sending this
166
00:09:28,640 --> 00:09:33,363
and now we should have only tours here that are in 2021.
167
00:09:34,230 --> 00:09:38,380
So let's confirm that 2021, here as well, here as well,
168
00:09:38,380 --> 00:09:40,040
here as well.
169
00:09:40,040 --> 00:09:45,040
Mm, so you see we really have no other year. Right.
170
00:09:45,050 --> 00:09:50,050
It's always 2021. Okay? So I think we've seen enough.
171
00:09:50,930 --> 00:09:55,870
And so, let's go back. Next up is where the magic happens.
172
00:09:55,870 --> 00:09:58,923
And so that is usually in the group stage.
173
00:09:59,960 --> 00:10:04,390
So let's add the group here, so just like before
174
00:10:04,390 --> 00:10:08,986
so group and remember we need to specify the ID field
175
00:10:08,986 --> 00:10:13,986
basically to say what we want to use to group our documents.
176
00:10:14,220 --> 00:10:17,330
Now we want to group them by the months, right?
177
00:10:17,330 --> 00:10:20,660
But currently we simply have the entire date,
178
00:10:20,660 --> 00:10:24,600
with the year, the month, the date, and even the hour.
179
00:10:24,600 --> 00:10:27,330
So I guess it's 10 in the morning or something.
180
00:10:27,330 --> 00:10:31,294
But again we only want the month. So let me show you
181
00:10:31,294 --> 00:10:34,843
just another like magical MongoDB operator.
182
00:10:36,340 --> 00:10:41,340
So, where is that? So, here, back in this reference here
183
00:10:42,500 --> 00:10:46,540
we actually have a couple of aggregation pipeline operators.
184
00:10:46,540 --> 00:10:50,320
And it's in here where we have this really handy uh
185
00:10:50,320 --> 00:10:53,369
date operator. So let's take a look at this.
186
00:10:53,369 --> 00:10:56,540
And the one that we're gonna use is month.
187
00:10:56,540 --> 00:11:00,210
So it returns to month for a date as a number.
188
00:11:00,210 --> 00:11:02,770
And so this will basically extract the month
189
00:11:02,770 --> 00:11:07,500
out of our date. And there are lots of other operators.
190
00:11:07,500 --> 00:11:10,990
Like this for example, we could even calculate the week
191
00:11:10,990 --> 00:11:12,590
or just the year, okay?
192
00:11:12,590 --> 00:11:14,940
But the week could also be very handy.
193
00:11:14,940 --> 00:11:19,110
But let's uh, let's keep it with the month. All right?
194
00:11:19,110 --> 00:11:21,320
So again, you can take a look at these uh--
195
00:11:21,320 --> 00:11:23,350
special aggregation operators.
196
00:11:23,350 --> 00:11:25,843
Because there are a ton of them, as you see here.
197
00:11:26,780 --> 00:11:29,710
Okay? So actually these operators that we're using here
198
00:11:29,710 --> 00:11:33,230
in the aggregation pipeline are uh, yeah exactly that.
199
00:11:33,230 --> 00:11:35,580
They are aggregation pipeline operators.
200
00:11:35,580 --> 00:11:39,900
We have stages and then operators that we can use. Okay.
201
00:11:39,900 --> 00:11:42,463
And in this case, again, we use the month.
202
00:11:46,653 --> 00:11:49,207
And then again the name of the field,
203
00:11:50,330 --> 00:11:54,060
where we want to basically extract the date from.
204
00:11:54,060 --> 00:11:58,720
All right, give it a save, then that error disappears, okay.
205
00:11:58,720 --> 00:12:01,380
So we are grouping it now by the month.
206
00:12:01,380 --> 00:12:03,760
And now the real information that we want
207
00:12:03,760 --> 00:12:08,160
for each of the month is how many tours start in that month?
208
00:12:08,160 --> 00:12:11,750
Right? And for that all we're gonna do is basically count
209
00:12:11,750 --> 00:12:16,190
the amount of tours that have a certain month, right?
210
00:12:16,190 --> 00:12:20,453
So num of tours starts.
211
00:12:21,520 --> 00:12:23,160
And so this one is actually
212
00:12:23,160 --> 00:12:24,923
very similar to what we did before.
213
00:12:26,170 --> 00:12:29,080
So we use add and then for each of the documents
214
00:12:29,080 --> 00:12:32,200
we add one. So just like we did before.
215
00:12:32,200 --> 00:12:37,100
But actually it is sum and not add, okay so just like here
216
00:12:37,100 --> 00:12:40,750
when we counted the tours for each of the difficulties
217
00:12:40,750 --> 00:12:44,030
we simply added the number one for each of the documents.
218
00:12:44,030 --> 00:12:45,773
And so here we do the same.
219
00:12:47,180 --> 00:12:50,243
All right, so let's again test this.
220
00:12:51,240 --> 00:12:54,193
And we're getting really close already to our end result.
221
00:12:55,240 --> 00:12:59,650
And indeed, here we go. So we have February with one tour.
222
00:12:59,650 --> 00:13:03,300
December with one tour, we have November or actually
223
00:13:03,300 --> 00:13:05,340
September with two tours.
224
00:13:05,340 --> 00:13:07,610
And then we have two tours in all of this in here
225
00:13:07,610 --> 00:13:10,140
actually we have three tours in July.
226
00:13:10,140 --> 00:13:13,750
So this is getting pretty close to our result.
227
00:13:13,750 --> 00:13:16,230
So that's absolutely fantastic.
228
00:13:16,230 --> 00:13:20,140
So this part here, which I think was the most difficult one
229
00:13:20,140 --> 00:13:21,713
is already working.
230
00:13:23,900 --> 00:13:24,920
All right.
231
00:13:24,920 --> 00:13:27,580
Now we actually want some more information
232
00:13:27,580 --> 00:13:29,780
which is not only how many tours
233
00:13:29,780 --> 00:13:33,293
but also which tours? So let's do that.
234
00:13:34,350 --> 00:13:37,300
So if you want information about which tours
235
00:13:37,300 --> 00:13:39,120
that should actually be an array.
236
00:13:39,120 --> 00:13:41,839
Right? Because how else would we specify
237
00:13:41,839 --> 00:13:45,970
two or three different tours in one field, right?
238
00:13:45,970 --> 00:13:48,840
And so basically we want to create an array
239
00:13:48,840 --> 00:13:51,652
and we do that by using push
240
00:13:51,652 --> 00:13:54,660
and then what we're gonna push into that array
241
00:13:54,660 --> 00:13:57,660
as each document goes through this pipeline
242
00:13:57,660 --> 00:13:59,853
is simply the name of the document,
243
00:14:02,010 --> 00:14:05,920
or actually the name field. So not the name of the document
244
00:14:05,920 --> 00:14:07,440
but the name field.
245
00:14:07,440 --> 00:14:12,113
So in this case the name of the tour. Okay so let's test it.
246
00:14:13,520 --> 00:14:15,380
And...
247
00:14:15,380 --> 00:14:17,870
bam, here we go!
248
00:14:17,870 --> 00:14:22,430
So we have also now the name of the tours in there.
249
00:14:22,430 --> 00:14:26,370
So fantastic. Let's see, yeah. Here we have all the three.
250
00:14:26,370 --> 00:14:29,560
Next up, let's actually uh change the name
251
00:14:29,560 --> 00:14:31,690
of this field here, okay?
252
00:14:31,690 --> 00:14:34,760
Now not really change but we're simply gonna add
253
00:14:34,760 --> 00:14:37,660
another field which will have the same value here
254
00:14:37,660 --> 00:14:41,363
so that later on we can basically delete this ID.
255
00:14:42,400 --> 00:14:46,450
Okay, and so for that we're gonna use the next stage
256
00:14:46,450 --> 00:14:48,313
which is called: add field.
257
00:14:50,490 --> 00:14:52,640
So add field and this one
258
00:14:52,640 --> 00:14:56,290
is pretty straight forward. It simply does what it says.
259
00:14:56,290 --> 00:14:59,990
So add field is used to add fields and actually it is
260
00:14:59,990 --> 00:15:01,980
called add fields.
261
00:15:01,980 --> 00:15:06,864
And so now, the name that we want to add or the field
262
00:15:06,864 --> 00:15:11,330
is called month and it has the value of
263
00:15:11,330 --> 00:15:13,463
the field with the name ID.
264
00:15:15,060 --> 00:15:17,670
All right. So, pretty straight forward
265
00:15:17,670 --> 00:15:20,300
simply the name of the field and then the value.
266
00:15:20,300 --> 00:15:24,670
Which as usual, we need to use the uh the dollar sign.
267
00:15:24,670 --> 00:15:27,870
All right, just to test it again.
268
00:15:27,870 --> 00:15:29,413
Indeed now we have the month.
269
00:15:30,500 --> 00:15:33,630
Then next up, let's actually get rid of this
270
00:15:33,630 --> 00:15:34,793
and so we use project.
271
00:15:38,860 --> 00:15:43,090
So I'm really trying to put as many stages in here as I can
272
00:15:43,090 --> 00:15:45,930
to-- to show you really everything I can.
273
00:15:45,930 --> 00:15:49,460
So how does project work? Well we simply give
274
00:15:49,460 --> 00:15:53,130
each of the field names a zero or a one.
275
00:15:53,130 --> 00:15:57,900
So let me show that to you. So we can say ID
276
00:15:57,900 --> 00:16:00,960
and set it to zero. And that will then make it so
277
00:16:00,960 --> 00:16:05,130
the ID no longer shows up. If I put a one here, well,
278
00:16:05,130 --> 00:16:08,160
then it would actually show up, okay?
279
00:16:08,160 --> 00:16:12,140
So this one I'm not gonna test. Let me just add the next one
280
00:16:12,140 --> 00:16:17,140
which is the sort one which I believe I used it before
281
00:16:17,440 --> 00:16:20,783
but still I want to sort it here by the number or tours.
282
00:16:21,640 --> 00:16:26,120
Okay, so right now it's not 100% useful we are still missing
283
00:16:26,120 --> 00:16:29,410
because we should actually sort it by uh, really by the
284
00:16:29,410 --> 00:16:30,820
number of tour starts.
285
00:16:30,820 --> 00:16:35,260
So the name of the field is number of tour starts
286
00:16:35,260 --> 00:16:39,290
and uh remember we had one before which was for ascending
287
00:16:39,290 --> 00:16:42,140
and minus one which was for descending and of course
288
00:16:42,140 --> 00:16:43,220
that's what we want.
289
00:16:43,220 --> 00:16:45,893
So starting with the highest number.
290
00:16:48,220 --> 00:16:53,220
So it should be three in our case and yeah, it is.
291
00:16:53,870 --> 00:16:57,720
So July is the busiest month with three tour starts
292
00:16:57,720 --> 00:17:01,440
the Forest Hiker, the Sea Explorer, and the Sports Lover.
293
00:17:01,440 --> 00:17:02,944
Okay, so this is kind of done.
294
00:17:02,944 --> 00:17:06,710
Let me just show you one, uh last stage here
295
00:17:06,710 --> 00:17:09,540
which is uh, not really helpful here
296
00:17:09,540 --> 00:17:11,560
but I wanted to show it to you anyway.
297
00:17:11,560 --> 00:17:15,210
So we have the limit, and this one is exactly the same
298
00:17:15,210 --> 00:17:19,109
as limit in uh query. So basically it is gonna allow us to
299
00:17:19,109 --> 00:17:21,880
only uh, have six documents here.
300
00:17:21,880 --> 00:17:23,762
Okay so basically six outputs.
301
00:17:25,160 --> 00:17:29,530
Okay so let's test that, and so now indeed
302
00:17:29,530 --> 00:17:30,650
we should only have six.
303
00:17:30,650 --> 00:17:35,160
One, two, three, four, five, and six. All right.
304
00:17:35,160 --> 00:17:39,150
Again, not really useful because that's uh gonna cutoff
305
00:17:39,150 --> 00:17:42,670
the six least biggest month, which we don't want.
306
00:17:42,670 --> 00:17:44,800
So let's simply set it to 12 here,
307
00:17:44,800 --> 00:17:49,010
just so we can leave it here as a reference for you.
308
00:17:49,010 --> 00:17:54,010
All right, so one more time but it, uh should be working now
309
00:17:54,470 --> 00:17:58,122
and the real business problem is now solved.
310
00:17:58,122 --> 00:18:01,400
And I know this is quite a lot of moving pieces
311
00:18:01,400 --> 00:18:04,150
that we have here. A lot of different stages.
312
00:18:04,150 --> 00:18:07,930
And so I know it's a lot for you to take in at this moment.
313
00:18:07,930 --> 00:18:10,670
But don't worry, you don't have to know all of this stuff
314
00:18:10,670 --> 00:18:12,170
all at the same time.
315
00:18:12,170 --> 00:18:14,970
With practice you will keep improving
316
00:18:14,970 --> 00:18:17,740
and you will know when to use which of the tools
317
00:18:17,740 --> 00:18:19,610
that you have at your disposal.
318
00:18:19,610 --> 00:18:22,220
Just keep in mind that you can always read the documentation
319
00:18:22,220 --> 00:18:25,840
which is kind of complete and really great learning material
320
00:18:25,840 --> 00:18:28,120
besides this course, okay?
321
00:18:28,120 --> 00:18:29,970
And that applies to all of the technologies
322
00:18:29,970 --> 00:18:31,140
that we're learning here.
323
00:18:31,140 --> 00:18:35,320
So I really encourage you to always study the documentation.
324
00:18:35,320 --> 00:18:39,220
And I know it can be really frightening to look at it
325
00:18:39,220 --> 00:18:42,390
and without this course it would be a lot more difficult
326
00:18:42,390 --> 00:18:44,240
to learn from the documentation
327
00:18:44,240 --> 00:18:46,270
but with this really good starting point
328
00:18:46,270 --> 00:18:49,200
that you get in these videos it's then a lot easier
329
00:18:49,200 --> 00:18:51,230
for you to keep learning more and more uh,
330
00:18:51,230 --> 00:18:54,220
using that documentation, okay?
331
00:18:54,220 --> 00:18:57,610
So I wouldn't expect you to solve this challenge
332
00:18:57,610 --> 00:19:01,180
on your own of course, which is why we basically
333
00:19:01,180 --> 00:19:03,170
did it together here, right?
334
00:19:03,170 --> 00:19:05,760
But I hope you had as much fun as I did
335
00:19:05,760 --> 00:19:10,030
because again, I really love to solve this kind of problems
336
00:19:10,030 --> 00:19:11,810
it's-- it's really fun I think.
337
00:19:11,810 --> 00:19:14,280
But anyway, enough talking now.
338
00:19:14,280 --> 00:19:16,880
In the rest of the section we will now talk about
339
00:19:16,880 --> 00:19:20,130
a couple of uh, other features we have available to us
340
00:19:20,130 --> 00:19:23,283
in Mongo, so that should be pretty fun as well.
27762
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.