1
00:00:00,390 --> 00:00:08,160
And once we're familiar with MongoDB, let's set up and configure MongoDB Atlas so we can host and manage

2
00:00:08,160 --> 00:00:09,600
our data in the cloud.

3
00:00:10,080 --> 00:00:16,140
I have the account already, but since I want to cover all the steps in detail, I'll set up another

4
00:00:16,140 --> 00:00:20,340
dummy account together and remember, we can set up the entire thing for free.

5
00:00:20,340 --> 00:00:27,450
So don't worry, your credit card can stay nicely tucked away in your wallet if you get stuck or confused

6
00:00:27,450 --> 00:00:29,580
in any of the steps we're about to take.

7
00:00:29,610 --> 00:00:31,800
Here is an awesome resource you can use.

8
00:00:32,070 --> 00:00:39,810
Just go create MongoDB Atlas and follow this link, which actually brings us to official docs.

9
00:00:40,020 --> 00:00:46,770
And here you'll find a checklist which we're going to use as our roadmap for the following few videos.

10
00:00:47,160 --> 00:00:49,320
And what is the first thing they want us to do?

11
00:00:49,440 --> 00:00:51,240
Create a new account.

12
00:00:51,240 --> 00:00:53,280
So let's do this, people.

13
00:00:53,730 --> 00:00:59,850
I'm going to open this up in new tab and then of course you can find a bunch of useful info on here,

14
00:00:59,850 --> 00:01:00,900
yada, yada, yada.

15
00:01:01,110 --> 00:01:02,340
You keep on scrolling.

16
00:01:02,430 --> 00:01:07,770
And I actually want to navigate to a login page and I'm just going to pretend that I don't have the

17
00:01:07,770 --> 00:01:10,740
account and we're going to go for signup.

18
00:01:10,980 --> 00:01:15,510
And here, of course, you just need to provide all the necessary info.

19
00:01:15,780 --> 00:01:20,610
And once you have filled everything out and as a side note, don't worry, this is not my real phone

20
00:01:20,610 --> 00:01:21,210
number.

21
00:01:21,300 --> 00:01:24,330
Then of course, just click on signup.

22
00:01:24,330 --> 00:01:28,950
And up next, they're going to ask for organization and project name.

23
00:01:29,040 --> 00:01:32,250
And in my case, I'm going to go with Node.

24
00:01:34,160 --> 00:01:36,440
Express course.

25
00:01:36,830 --> 00:01:45,020
Then I'll pick JavaScript, we'll click on continue and we probably can actually skip this, but let's

26
00:01:45,020 --> 00:01:46,490
just leave it there and add up.

27
00:01:46,490 --> 00:01:48,440
Next, they want us to set up the cluster.

28
00:01:48,620 --> 00:01:54,580
Now if you take a look at the checklist, actually cluster is already second step.

29
00:01:54,590 --> 00:02:00,950
So let's go back here and pretty much you always want to show for two, three, one, unless of course,

30
00:02:00,950 --> 00:02:02,210
you want to start paying them.

31
00:02:02,210 --> 00:02:07,130
So and here we'll just go with create cluster that's going to be the free one.

32
00:02:07,280 --> 00:02:14,420
Then it's using a was awesome as far as region, I'm going to go with this one and then we have cluster

33
00:02:14,420 --> 00:02:18,470
tier and additional settings and we'll leave them both as default.

34
00:02:18,740 --> 00:02:26,570
And lastly, I just want to change the name and I think I'm going to go with Node Express and Project,

35
00:02:26,570 --> 00:02:33,770
and once we're done, we just need to click on Create Cluster and we'll get ourselves a new cluster.

36
00:02:34,010 --> 00:02:39,770
Now, as you can see over here, they say that it's going to take a little bit of time, which is usually

37
00:02:39,770 --> 00:02:40,340
the case.

38
00:02:40,340 --> 00:02:46,550
So I'll stop the video here and I'll see you in the next one where we'll continue with our steps.

39
00:02:47,060 --> 00:02:51,800
And once our cluster is ready to go before we start messing around with data.

40
00:02:51,830 --> 00:02:58,100
So with collections and documents and all that, there's a few things that I want to do first, and

41
00:02:58,100 --> 00:03:00,980
I'm going to start by setting up the database access.

42
00:03:01,310 --> 00:03:06,050
So effectively in here we'll set who can access our database.

43
00:03:06,050 --> 00:03:09,260
Now, I'm not talking about the Atlas account.

44
00:03:09,410 --> 00:03:16,460
No, I'm talking about the database and collections we're about to set up, and we simply need to click

45
00:03:16,460 --> 00:03:21,410
on add new database user and we're going to go with password.

46
00:03:21,530 --> 00:03:25,010
And if you get some default values, just wipe them clean.

47
00:03:25,370 --> 00:03:27,680
And I'll simply go with John.

48
00:03:27,920 --> 00:03:34,070
And as far as the password, I'm just going to go with one, two, three for please, please, please

49
00:03:34,070 --> 00:03:36,740
do not do that in your own setup.

50
00:03:36,770 --> 00:03:40,400
The only reason why I'm doing that, because you'll be able to see my password anyway.

51
00:03:40,400 --> 00:03:46,280
And don't worry, once I'm done setting up this project, of course I will change my password.

52
00:03:46,280 --> 00:03:48,620
So it's not going to be one, two, three, four.

53
00:03:48,800 --> 00:03:55,790
And once you're done with the user and password notice we have database user privileges and less user

54
00:03:55,790 --> 00:03:58,790
can read and write to any database.

55
00:03:58,790 --> 00:04:03,020
So I'll leave it the way it is and add a new user.

56
00:04:03,410 --> 00:04:04,580
That's good.

57
00:04:04,580 --> 00:04:05,930
I'll close this one.

58
00:04:06,290 --> 00:04:07,100
A quick update.

59
00:04:07,100 --> 00:04:14,390
Since I recorded this video, a setup for read and write privileges is a little bit different and it's

60
00:04:14,390 --> 00:04:16,850
very easy to kind of skip that.

61
00:04:18,380 --> 00:04:25,460
And you'll have the bugs later when you try to connect to Atlas from your local application.

62
00:04:25,820 --> 00:04:28,190
So let's say you want to create a new user.

63
00:04:28,670 --> 00:04:30,380
In my case, I'm going to go.

64
00:04:31,210 --> 00:04:35,410
Beta going to auto generate a secure password.

65
00:04:35,740 --> 00:04:37,330
So this is what they give me.

66
00:04:37,780 --> 00:04:46,900
And notice how in the video automatically the reading right was added, right there was the select box.

67
00:04:47,170 --> 00:04:53,830
In this case we need to go with add built in row if you'll save basically, if you'll add this user

68
00:04:53,830 --> 00:05:00,670
without selecting this, that's when you will get those box when you try to connect from your local

69
00:05:00,670 --> 00:05:01,600
application.

70
00:05:01,810 --> 00:05:07,780
Back to the atlas, even though your password is going to be correct and username and all that, if

71
00:05:07,780 --> 00:05:10,780
you don't set this at all, yes, you'll get the bug.

72
00:05:11,170 --> 00:05:17,560
So therefore click here on ADD built in row and then you select the URL whether it's going to be an

73
00:05:17,560 --> 00:05:20,770
admin, read and write or only read.

74
00:05:20,770 --> 00:05:24,700
So in my case I'm going to go with, read and write and then we save.

75
00:05:24,850 --> 00:05:28,810
After that, everything is exactly the same as I show in the video.

76
00:05:29,980 --> 00:05:34,780
Just make sure that you click on that add built in roll.

77
00:05:35,170 --> 00:05:38,200
And then we want to set up the network access.

78
00:05:38,350 --> 00:05:43,510
So we want to set up from where we can access our database.

79
00:05:43,720 --> 00:05:49,600
And you can imagine that, of course, once we deploy the project, that of course will set up that

80
00:05:49,600 --> 00:05:50,560
IP address.

81
00:05:50,560 --> 00:05:56,200
But for the time being, while we work locally, we might as well set up access from anywhere.

82
00:05:56,230 --> 00:06:02,830
Now, if you want, you can set up your own IP address here so you can just add the current one.

83
00:06:02,830 --> 00:06:08,590
But in my case, I'm going to go allow access from anywhere and I'll just click on confirm.

84
00:06:08,770 --> 00:06:15,730
And lastly, I want to get the connection string that we're going to use once we connect our database

85
00:06:15,730 --> 00:06:17,410
to our application.

86
00:06:17,410 --> 00:06:20,470
And in here, what you're looking for is connect.

87
00:06:20,620 --> 00:06:27,070
So you want to go back to the cluster, then connect and then you want to go with connect your application.

88
00:06:27,070 --> 00:06:30,460
So not the Kompass one, not the Mongo shell.

89
00:06:30,520 --> 00:06:37,480
Actually the second one here, connect your application and then I'm going to go with 3.6 or later.

90
00:06:37,780 --> 00:06:39,040
That's about right.

91
00:06:39,040 --> 00:06:43,990
And then you just want to copy this one and then navigate back to our project.

92
00:06:44,410 --> 00:06:45,610
A quick update.

93
00:06:45,700 --> 00:06:54,100
At this point, Atlas does not provide the default database name anymore, so instead of my first database,

94
00:06:54,250 --> 00:06:56,740
now the connection string looks like this.

95
00:06:57,480 --> 00:07:03,480
Where the value between MongoDB dot net and question mark is simply empty.

96
00:07:04,460 --> 00:07:05,840
Now, it's not a big deal.

97
00:07:06,230 --> 00:07:08,540
Just add your own database name.

98
00:07:09,320 --> 00:07:14,540
Once the connection string is in your text editor again, let me repeat.

99
00:07:15,920 --> 00:07:17,900
Everything else stays the same.

100
00:07:18,440 --> 00:07:22,850
Just the default database name is missing from the connection string.

101
00:07:22,970 --> 00:07:26,210
So we need to add it by ourselves.

102
00:07:26,630 --> 00:07:30,710
Now, eventually we'll set it up as the environment variable.

103
00:07:30,740 --> 00:07:32,590
Yes, that's going to be the case.

104
00:07:32,600 --> 00:07:39,530
But for the time being I'll simply create a new folder in the starter and I'll call this DB.

105
00:07:39,950 --> 00:07:47,150
And then instead of the DB there's going to be a new file and I'll call this connect JS and then I want

106
00:07:47,150 --> 00:07:54,290
to create a new variable and I'll call this connection string and I'll set it equal to that value.

107
00:07:54,440 --> 00:08:02,120
Now we'll have to add some values over here, but we'll do that later once we're actually ready to connect

108
00:08:02,120 --> 00:08:04,100
our application to the database.

109
00:08:04,100 --> 00:08:05,700
So just take the string.

110
00:08:05,720 --> 00:08:10,190
Copy and paste, set it up in the DB and then connect.

111
00:08:10,220 --> 00:08:15,470
Jess And now we can start exploring the Atlas setup.

