Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,180 --> 00:00:02,490
Welcome back.
2
00:00:02,490 --> 00:00:07,300
In this lecture, we will install MongoDB on macOS.
3
00:00:07,300 --> 00:00:09,370
Now, if you're a Windows user,
4
00:00:09,370 --> 00:00:12,200
then please mark this video as completed,
5
00:00:12,200 --> 00:00:14,170
and move on right to the next one
6
00:00:14,170 --> 00:00:15,880
because the installation process
7
00:00:15,880 --> 00:00:18,380
is actually quite different on Windows
8
00:00:18,380 --> 00:00:19,523
than it is on Mac.
9
00:00:20,520 --> 00:00:22,350
So fire up your browser,
10
00:00:22,350 --> 00:00:25,070
and open MongoDB.com.
11
00:00:25,070 --> 00:00:25,903
Okay?
12
00:00:25,903 --> 00:00:27,600
Then, move to products.
13
00:00:27,600 --> 00:00:30,760
And then over here, the MongoDB server.
14
00:00:30,760 --> 00:00:32,640
So, open that one up.
15
00:00:32,640 --> 00:00:36,290
And so that takes us to the MongoDB download center.
16
00:00:36,290 --> 00:00:39,900
So the one that we want is the MongoDB community server,
17
00:00:39,900 --> 00:00:42,260
and then of course, the current release.
18
00:00:42,260 --> 00:00:46,040
So not the more experimental four point one.
19
00:00:46,040 --> 00:00:47,840
Then, your OS should automatically
20
00:00:47,840 --> 00:00:49,550
be selected as macOS.
21
00:00:49,550 --> 00:00:51,033
And then the package.
22
00:00:52,290 --> 00:00:53,960
This is the only option anyway.
23
00:00:53,960 --> 00:00:55,750
And so, hit download.
24
00:00:55,750 --> 00:00:58,440
And then wait for it to complete.
25
00:00:58,440 --> 00:01:00,090
Now while this is downloading,
26
00:01:00,090 --> 00:01:04,230
notice how the website here talks about MongoDB Atlas
27
00:01:04,230 --> 00:01:07,530
which is Mongo's database as a service.
28
00:01:07,530 --> 00:01:11,820
So basically, it's running MongoDB in the Cloud on Atlas
29
00:01:11,820 --> 00:01:13,580
instead of running it locally.
30
00:01:13,580 --> 00:01:15,130
And actually, later in this section,
31
00:01:15,130 --> 00:01:17,390
that is exactly what we're gonna do.
32
00:01:17,390 --> 00:01:20,140
So we will create an Atlas account,
33
00:01:20,140 --> 00:01:22,810
and run our database in the Cloud.
34
00:01:22,810 --> 00:01:23,690
Okay?
35
00:01:23,690 --> 00:01:26,530
So in this video, we're downloading and installing
36
00:01:26,530 --> 00:01:29,070
the local version of MongoDB,
37
00:01:29,070 --> 00:01:33,310
which we will use to get familiar with the database system.
38
00:01:33,310 --> 00:01:34,780
But then, by the end of the section,
39
00:01:34,780 --> 00:01:38,000
we will actually transition to the hosted version,
40
00:01:38,000 --> 00:01:40,190
and that's the one we will then use
41
00:01:40,190 --> 00:01:43,870
in our real application until the end of the course.
42
00:01:43,870 --> 00:01:44,703
All right.
43
00:01:44,703 --> 00:01:46,400
And with the file now downloaded,
44
00:01:46,400 --> 00:01:48,800
let's go ahead and extract it,
45
00:01:48,800 --> 00:01:51,220
and take a look at the content.
46
00:01:51,220 --> 00:01:52,990
And what we need here is basically
47
00:01:52,990 --> 00:01:55,180
these executable files here.
48
00:01:55,180 --> 00:01:56,730
And what we need to do with them
49
00:01:56,730 --> 00:02:00,170
is to copy them into a special binary folder
50
00:02:00,170 --> 00:02:02,260
that we have on our system.
51
00:02:02,260 --> 00:02:03,093
Okay?
52
00:02:03,093 --> 00:02:07,040
So let's move into our terminal and do a copy command,
53
00:02:07,040 --> 00:02:08,930
and we're gonna need some permissions forwarded,
54
00:02:08,930 --> 00:02:11,050
so I'm starting with sudo here.
55
00:02:11,050 --> 00:02:12,890
Then cp for copy.
56
00:02:12,890 --> 00:02:15,310
And now, I'm gonna go add and drag
57
00:02:15,310 --> 00:02:17,960
all of these files in here so that
58
00:02:17,960 --> 00:02:20,803
I don't have to write the path to them out.
59
00:02:22,160 --> 00:02:23,060
Okay.
60
00:02:23,060 --> 00:02:25,990
So that's all of the files that we're gonna copy.
61
00:02:25,990 --> 00:02:28,420
And we will copy them into a folder
62
00:02:28,420 --> 00:02:33,420
called slash usr local slash bin.
63
00:02:34,790 --> 00:02:36,860
Hit return on that, and just to make sure
64
00:02:36,860 --> 00:02:40,060
they're actually there, let's actually go there.
65
00:02:40,060 --> 00:02:43,203
Usr local slash bin.
66
00:02:44,750 --> 00:02:46,410
Take a look at the files there.
67
00:02:46,410 --> 00:02:49,190
And indeed, here they are.
68
00:02:49,190 --> 00:02:52,830
So basically these red files are the ones
69
00:02:52,830 --> 00:02:54,040
that we just copied there.
70
00:02:54,040 --> 00:02:56,060
So these aren't executable.
71
00:02:56,060 --> 00:02:57,260
Now since we're in this folder,
72
00:02:57,260 --> 00:03:00,120
you might actually see some other interesting stuff here.
73
00:03:00,120 --> 00:03:02,950
For example, there's nodemon command here.
74
00:03:02,950 --> 00:03:04,990
That is the global nodemon package
75
00:03:04,990 --> 00:03:07,340
that we actually installed before.
76
00:03:07,340 --> 00:03:09,860
I mean, it's not really the package itself,
77
00:03:09,860 --> 00:03:12,890
but it is this what allows us to run
78
00:03:12,890 --> 00:03:14,793
the nodemon command globally.
79
00:03:15,670 --> 00:03:17,600
Next up, we're gonna create a folder
80
00:03:17,600 --> 00:03:20,610
where the database can then actually store the data.
81
00:03:20,610 --> 00:03:23,060
And again, we're gonna need permissions for that.
82
00:03:23,910 --> 00:03:27,610
So mkdir to make the new directory,
83
00:03:27,610 --> 00:03:32,470
and then slash data slash db.
84
00:03:32,470 --> 00:03:33,440
Hit return.
85
00:03:33,440 --> 00:03:36,940
And in my case, this folder actually already exists.
86
00:03:36,940 --> 00:03:39,240
And so, I'm not able to create a new one.
87
00:03:39,240 --> 00:03:43,480
But in your case, I'm sure this worked just fine.
88
00:03:43,480 --> 00:03:45,520
Next up, we need to give some permissions
89
00:03:45,520 --> 00:03:47,660
in order for the database to be able
90
00:03:47,660 --> 00:03:49,820
to write in this folder.
91
00:03:49,820 --> 00:03:52,343
And so for that, again, we use sudo.
92
00:03:54,340 --> 00:03:58,463
Then this weird command here, chown, or whatever.
93
00:03:59,360 --> 00:04:01,600
And R for recursive.
94
00:04:01,600 --> 00:04:06,600
Then id minus un and slash data slash db.
95
00:04:09,881 --> 00:04:10,870
All right.
96
00:04:10,870 --> 00:04:13,460
So this looks a bit like black magic here,
97
00:04:13,460 --> 00:04:15,500
but again, just follow this recipe
98
00:04:15,500 --> 00:04:17,899
in order to just make this work.
99
00:04:17,899 --> 00:04:20,660
Anyway, we should now be good to go.
100
00:04:20,660 --> 00:04:23,480
And call mongod.
101
00:04:23,480 --> 00:04:24,763
So let's try that out.
102
00:04:26,410 --> 00:04:29,060
So let's make this window a bit bigger.
103
00:04:29,060 --> 00:04:32,900
And so indeed, we now have the Mongo process running here.
104
00:04:32,900 --> 00:04:33,740
Okay.
105
00:04:33,740 --> 00:04:35,430
So it starts up here.
106
00:04:35,430 --> 00:04:38,950
And then gives us all the stuff that we don't really need.
107
00:04:38,950 --> 00:04:41,720
And by the end, it tells us that it's waiting
108
00:04:41,720 --> 00:04:44,653
for connections on port 27017.
109
00:04:45,644 --> 00:04:46,477
Okay?
110
00:04:46,477 --> 00:04:50,030
So this here is basically like a Mongo server.
111
00:04:50,030 --> 00:04:50,863
Okay?
112
00:04:50,863 --> 00:04:54,630
So this means that MongoDB is now running in the background.
113
00:04:54,630 --> 00:04:57,420
But we need to now actually connect to it
114
00:04:57,420 --> 00:04:59,960
in order to create new databases,
115
00:04:59,960 --> 00:05:02,880
and create new collections and all that good stuff.
116
00:05:02,880 --> 00:05:03,713
Okay?
117
00:05:03,713 --> 00:05:05,120
So in this terminal window,
118
00:05:05,120 --> 00:05:07,730
we will leave this process running.
119
00:05:07,730 --> 00:05:10,240
So basically this MongoDB server.
120
00:05:10,240 --> 00:05:11,980
And we then open another tab,
121
00:05:11,980 --> 00:05:14,060
or you could open another window.
122
00:05:14,060 --> 00:05:17,710
But I just use command t to open another tab.
123
00:05:17,710 --> 00:05:20,340
And now, we run the Mongo shell
124
00:05:20,340 --> 00:05:22,630
simply by writing Mongo.
125
00:05:22,630 --> 00:05:23,463
All right.
126
00:05:23,463 --> 00:05:26,400
And we are now connected to our MongoDB server
127
00:05:26,400 --> 00:05:30,000
that is running on local host on the default port
128
00:05:30,000 --> 00:05:31,650
that I just mentioned before.
129
00:05:31,650 --> 00:05:33,240
So this one.
130
00:05:33,240 --> 00:05:34,073
Okay.
131
00:05:34,073 --> 00:05:35,380
So we are now connected to that,
132
00:05:35,380 --> 00:05:38,130
and so let's now write db here,
133
00:05:38,130 --> 00:05:40,670
which should return the task database.
134
00:05:40,670 --> 00:05:42,250
And it did.
135
00:05:42,250 --> 00:05:43,083
So.
136
00:05:43,083 --> 00:05:45,730
We have a test database already on our computer.
137
00:05:45,730 --> 00:05:48,300
And so this means that it works.
138
00:05:48,300 --> 00:05:49,830
So, great.
139
00:05:49,830 --> 00:05:52,310
Now we could have used this Mongo shell here
140
00:05:52,310 --> 00:05:55,220
to also connect to a remote database.
141
00:05:55,220 --> 00:05:56,880
So, remember how in the beginning,
142
00:05:56,880 --> 00:05:59,840
I talked about the MongoDB Atlas
143
00:05:59,840 --> 00:06:02,600
which is basically a database running in the Cloud.
144
00:06:02,600 --> 00:06:04,430
So a remote database.
145
00:06:04,430 --> 00:06:07,630
And so here, we could use this MongoDB shell
146
00:06:07,630 --> 00:06:09,540
to also connect to that one.
147
00:06:09,540 --> 00:06:12,750
But if we simply run the mongo command like we did here,
148
00:06:12,750 --> 00:06:14,490
it will just automatically connect
149
00:06:14,490 --> 00:06:16,820
to the local MongoDB database
150
00:06:16,820 --> 00:06:18,970
that is running on local host.
151
00:06:18,970 --> 00:06:19,803
Okay.
152
00:06:19,803 --> 00:06:21,280
So that's it for this video.
153
00:06:21,280 --> 00:06:23,740
In the next one, we will then create
154
00:06:23,740 --> 00:06:26,130
our first new database, and start
155
00:06:26,130 --> 00:06:28,983
to interact a little bit more with this Mongo shell.
11223
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.