1
00:00:02,040 --> 00:00:04,300
Now of course, hosting our website code

2
00:00:04,300 --> 00:00:09,270
is one thing, but what if we also have a database server?

3
00:00:09,270 --> 00:00:12,940
We must not forget that such a database server

4
00:00:12,940 --> 00:00:16,260
is really just that, a standalone server

5
00:00:16,260 --> 00:00:19,330
that's decoupled from our website server

6
00:00:19,330 --> 00:00:21,490
and our website code.

7
00:00:21,490 --> 00:00:24,460
Sure, our website code will often interact

8
00:00:24,460 --> 00:00:26,510
with that database server,

9
00:00:26,510 --> 00:00:29,600
but it's still a standalone server.

10
00:00:29,600 --> 00:00:31,360
And thus far in the course,

11
00:00:31,360 --> 00:00:34,780
no matter if we used MySQL or MongoDB,

12
00:00:34,780 --> 00:00:38,510
we started a fitting server on our local machine

13
00:00:38,510 --> 00:00:43,300
just as we started the website server on our local machine.

14
00:00:43,300 --> 00:00:46,850
You saw code like this where we connect to a database

15
00:00:46,850 --> 00:00:49,340
quite a bit throughout this course.

16
00:00:49,340 --> 00:00:53,900
And here, of course, you might notice that this URL

17
00:00:53,900 --> 00:00:55,660
to which we are connecting

18
00:00:55,660 --> 00:00:59,110
actually does use a different port,

19
00:00:59,110 --> 00:01:02,500
27017 by default for MongoDB,

20
00:01:02,500 --> 00:01:05,980
than our website uses for exposing,

21
00:01:05,980 --> 00:01:08,360
well, our website to the world

22
00:01:08,360 --> 00:01:10,620
or to our local machine right now.

23
00:01:10,620 --> 00:01:14,400
There, we used port 3000 as a default.

24
00:01:14,400 --> 00:01:17,600
Hence, we have two different servers involved.

25
00:01:17,600 --> 00:01:21,520
And thus far, we only learned how we can host websites

26
00:01:21,520 --> 00:01:24,610
and web servers, depending on whether it's a static

27
00:01:24,610 --> 00:01:26,250
or a dynamic website,

28
00:01:26,250 --> 00:01:28,793
but we haven't talked about hosting databases.

29
00:01:29,830 --> 00:01:33,360
We, of course, also wanna host database servers.

30
00:01:33,360 --> 00:01:36,060
And theoretically, just as with websites,

31
00:01:36,060 --> 00:01:38,830
you could rent a machine or build your own machine

32
00:01:38,830 --> 00:01:42,210
and install your database server on it and configure it

33
00:01:42,210 --> 00:01:44,810
such that it's correctly exposed to the world

34
00:01:44,810 --> 00:01:48,280
so that your website server is able to talk to it.

35
00:01:48,280 --> 00:01:52,170
But basically, just as with the website servers

36
00:01:52,170 --> 00:01:53,950
and the machines on which they run,

37
00:01:53,950 --> 00:01:57,790
you wanna avoid building and configuring this on your own

38
00:01:57,790 --> 00:02:00,220
because it's easy to mess something up there

39
00:02:00,220 --> 00:02:02,020
and hard to get it right

40
00:02:02,020 --> 00:02:05,130
and it's easy to introduce security problems

41
00:02:05,130 --> 00:02:07,060
or anything like this.

42
00:02:07,060 --> 00:02:09,860
So therefore, whilst you could rent a remote machine

43
00:02:09,860 --> 00:02:12,480
and install and run a database server on it,

44
00:02:12,480 --> 00:02:14,100
you typically don't wanna do that

45
00:02:14,100 --> 00:02:17,210
because it's difficult to configure in a secure way.

46
00:02:17,210 --> 00:02:18,930
And as your website grows,

47
00:02:18,930 --> 00:02:21,800
you also might run into scaling problems

48
00:02:21,800 --> 00:02:24,690
where at some point your pre-configured

49
00:02:24,690 --> 00:02:27,730
simple database server might be overwhelmed

50
00:02:27,730 --> 00:02:30,573
by the amount of incoming traffic and requests.

51
00:02:31,720 --> 00:02:35,240
Therefore, for databases, we typically also wanna use

52
00:02:35,240 --> 00:02:37,360
dedicated hosting providers,

53
00:02:37,360 --> 00:02:40,010
though the difference here is that we don't just want

54
00:02:40,010 --> 00:02:42,160
a provider that gives us a machine

55
00:02:42,160 --> 00:02:44,500
onto which we can upload our code

56
00:02:44,500 --> 00:02:46,210
because we have no code here.

57
00:02:46,210 --> 00:02:48,470
Instead, we want a provider that gives us

58
00:02:48,470 --> 00:02:51,970
a readily configured database server

59
00:02:51,970 --> 00:02:55,070
that runs somewhere on some remote machine

60
00:02:55,070 --> 00:02:58,350
which is managed by that service provider

61
00:02:58,350 --> 00:03:02,020
so that we don't to care about that at all.

62
00:03:02,020 --> 00:03:06,720
And for MongoDB, MongoDB Atlas is a really amazing,

63
00:03:06,720 --> 00:03:10,220
fully-managed cloud database service,

64
00:03:10,220 --> 00:03:13,390
cloud simply means that it runs on some remote machines

65
00:03:13,390 --> 00:03:15,480
which we don't manage on our own,

66
00:03:15,480 --> 00:03:19,840
and this is an amazing service actually provided by the team

67
00:03:19,840 --> 00:03:22,610
that also works on MongoDB itself.

68
00:03:22,610 --> 00:03:25,160
And it is an amazing service which we will use

69
00:03:25,160 --> 00:03:28,010
throughout this course section.

70
00:03:28,010 --> 00:03:29,870
Right now, you don't have to do anything.

71
00:03:29,870 --> 00:03:32,790
You can read something about it if you want to,

72
00:03:32,790 --> 00:03:34,420
but we'll start using it together

73
00:03:34,420 --> 00:03:36,720
later in this course section.

74
00:03:36,720 --> 00:03:39,690
For the moment, I just want to make you aware of it.

75
00:03:39,690 --> 00:03:41,250
And most importantly,

76
00:03:41,250 --> 00:03:46,140
you should understand why we use such a fully-hosted service

77
00:03:46,140 --> 00:03:49,600
for a database because doing it right on our own

78
00:03:49,600 --> 00:03:51,283
is really, really tricky.

