1
00:00:00,080 --> 00:00:00,470
All right.

2
00:00:00,470 --> 00:00:04,880
And up next, we're going to create a new Atlas account together.

3
00:00:05,000 --> 00:00:09,940
Now, of course, if you already have an account, feel free to skip this video.

4
00:00:09,950 --> 00:00:17,810
But if you are new to MongoDB and Atlas, please repeat the same steps since otherwise you won't be

5
00:00:17,840 --> 00:00:19,520
able to follow along.

6
00:00:19,550 --> 00:00:26,330
First navigate to mongodb.com and look for try free link.

7
00:00:31,890 --> 00:00:33,870
Then fill out all of the values.

8
00:00:41,690 --> 00:00:45,470
Then they will ask you to verify your email address.

9
00:00:48,600 --> 00:00:51,330
After that, they all just asked some random questions.

10
00:00:52,640 --> 00:00:59,420
Up next pick the free option provider can stay and just click on Create.

11
00:00:59,450 --> 00:01:02,900
After that, they will ask how we want to authenticate our connection.

12
00:01:02,900 --> 00:01:08,270
And essentially what they're talking about is the read and write privileges.

13
00:01:08,860 --> 00:01:10,450
To our project.

14
00:01:10,630 --> 00:01:14,350
So basically, we're not talking about the entire account?

15
00:01:14,560 --> 00:01:15,310
No.

16
00:01:15,840 --> 00:01:22,790
For every database you'll be able to set up users and they will have some privileges.

17
00:01:22,800 --> 00:01:29,040
For example, the menus are, of course, can read and write, but some users can only read or access

18
00:01:29,040 --> 00:01:29,460
data.

19
00:01:29,460 --> 00:01:38,040
So essentially for our database that we're about to set up, we need to create the first user and they'll

20
00:01:38,040 --> 00:01:43,500
right away set it as read and write so that user can pretty much do anything in our database.

21
00:01:43,500 --> 00:01:47,970
And effectively, yes, that user will be us.

22
00:01:48,210 --> 00:01:49,590
Hopefully that makes sense.

23
00:01:49,830 --> 00:01:53,640
And effectively we want to go here with some kind of username.

24
00:01:53,670 --> 00:01:58,740
In my case, I'm going to stick with John and since you'll be able to see my password anyway, I'm going

25
00:01:58,740 --> 00:02:00,720
to go with secret one, two, three.

26
00:02:00,720 --> 00:02:09,000
But please keep in mind that of course, whenever you're setting up your permissions for user, try

27
00:02:09,000 --> 00:02:11,280
to go with something more complex.

28
00:02:11,310 --> 00:02:16,780
Again, it doesn't really matter for me since you'll be able to see it when we set up a connection.

29
00:02:16,780 --> 00:02:20,650
And of course, once I'm done recording the course, I'll change the password.

30
00:02:20,650 --> 00:02:27,700
So again, we are creating a user for the database, not for the entire account.

31
00:02:27,700 --> 00:02:31,300
And after that they ask Where do we want to connect from?

32
00:02:31,660 --> 00:02:37,840
So effectively this is going to be my local environment and as you can see there, right away give you

33
00:02:37,840 --> 00:02:44,710
this option to use the current IP address or it's going to be more advanced and we're going to go with

34
00:02:44,710 --> 00:02:46,210
cloud environment.

35
00:02:46,300 --> 00:02:52,630
And essentially, since we're going to deploy the project, I highly recommend actually whitelisting,

36
00:02:52,630 --> 00:02:58,870
essentially just add the IP address which signals that we can access the project from anywhere because

37
00:02:58,870 --> 00:03:07,330
once we deploy the project, usually on platforms like Render, there is no one set IP address.

38
00:03:07,360 --> 00:03:08,680
Effectively it's changing.

39
00:03:08,680 --> 00:03:14,890
And if you want the project to actually work, then again you'll have to whitelist it over here.

40
00:03:14,890 --> 00:03:15,880
Very, very important.

41
00:03:15,880 --> 00:03:19,900
So in order to do that, we're going to go with 000.

42
00:03:20,230 --> 00:03:21,640
As far as description.

43
00:03:21,820 --> 00:03:24,190
Basically I'll say my connection.

44
00:03:25,230 --> 00:03:29,220
Then let's add and pretty much we're good to go.

45
00:03:29,250 --> 00:03:32,760
And at the very end, we just want to go finish and close.

46
00:03:32,790 --> 00:03:37,710
And once we're done answering the questions, up next, we want to connect to our database.

47
00:03:37,710 --> 00:03:43,140
So I'm not going to spend any time at the moment here in the dashboard since we don't have any data.

48
00:03:43,140 --> 00:03:48,210
So first, let's create the data and then I'll show you the collections and all that cool stuff.

49
00:03:48,210 --> 00:03:50,520
So first we want to click on Connect.

50
00:03:50,620 --> 00:03:52,830
Then we're looking for drivers.

51
00:03:52,950 --> 00:03:58,760
I'm going to go with NodeJS, then version 5.5 or later.

52
00:03:58,770 --> 00:04:02,400
Now don't worry about this NPM install since we'll use the mongoose.

53
00:04:02,430 --> 00:04:05,280
What we're looking for is this connection string.

54
00:04:05,400 --> 00:04:10,490
And essentially once we get it to our project, we'll need to add the password.

55
00:04:10,500 --> 00:04:13,320
Like I said, you'll be able to see my password.

56
00:04:13,320 --> 00:04:20,190
And also here, right after the forward slash, this is where we set up the name for the database.

57
00:04:20,190 --> 00:04:26,890
Now, as far as I remember, if you don't provide the name here, the value, then they automatically

58
00:04:26,890 --> 00:04:27,490
create one.

59
00:04:27,490 --> 00:04:31,090
And I believe they call it test, but I'm not 100% sure.

60
00:04:31,090 --> 00:04:36,010
So effectively, just grab this copy, then navigate back to the project.

61
00:04:36,010 --> 00:04:41,140
We already have Dot EMV and this is where we want to create another environment variable.

62
00:04:41,230 --> 00:04:43,000
And this is the important one.

63
00:04:43,000 --> 00:04:48,520
This is the one we definitely don't want to share when we set up our source control.

64
00:04:48,520 --> 00:04:51,340
Basically when we're pushing this up to a GitHub.

65
00:04:51,340 --> 00:04:59,920
So we'll have the local one which we'll use over here and I'm going to call this Mongo URL, then I'll

66
00:04:59,920 --> 00:05:03,220
set it equal to then copy and paste.

67
00:05:03,220 --> 00:05:06,430
And like I said, first we need to provide the password.

68
00:05:06,550 --> 00:05:08,650
If you remember my one was secret.

69
00:05:08,680 --> 00:05:09,550
One, two, three.

70
00:05:09,550 --> 00:05:14,530
Again, remember we're talking about a user which is accessing the database.

71
00:05:14,530 --> 00:05:19,930
So I'm not accessing the entire account, I'm just accessing that one specific database.

72
00:05:20,020 --> 00:05:26,370
And then as far as the name, I'm just going to go here with Shopify, all uppercase, let's save it.

73
00:05:26,370 --> 00:05:33,810
And before we start discussing our next topic, I also want to quickly show you the extension, the

74
00:05:33,810 --> 00:05:39,570
dot env extension, which sets up the keys in a different color than the value.

75
00:05:39,840 --> 00:05:41,670
Just in case you're interested.

76
00:05:41,670 --> 00:05:47,030
So make sure you create the account, Make sure you set up a user.

77
00:05:47,040 --> 00:05:50,220
You also have the correct connection.

78
00:05:50,220 --> 00:05:58,590
Again, I'm basically allowing access from anywhere and also grab the connection string, make sure

79
00:05:58,590 --> 00:06:01,320
to add a proper password.

80
00:06:01,350 --> 00:06:04,650
And I also provided my own database name.

81
00:06:04,650 --> 00:06:09,150
And once you have completed all of these steps, we can move on to the next topic.

