All right.
And up next, we're going to create a new Atlas account together.
Now, of course, if you already have an account, feel free to skip this video.
But if you are new to MongoDB and Atlas, please repeat the same steps since otherwise you won't be
able to follow along.
First navigate to mongodb.com and look for try free link.
Then fill out all of the values.
Then they will ask you to verify your email address.
After that, they all just asked some random questions.
Up next pick the free option provider can stay and just click on Create.
After that, they will ask how we want to authenticate our connection.
And essentially what they're talking about is the read and write privileges.
To our project.
So basically, we're not talking about the entire account?
No.
For every database you'll be able to set up users and they will have some privileges.
For example, the menus are, of course, can read and write, but some users can only read or access
data.
So essentially for our database that we're about to set up, we need to create the first user and they'll
right away set it as read and write so that user can pretty much do anything in our database.
And effectively, yes, that user will be us.
Hopefully that makes sense.
And effectively we want to go here with some kind of username.
In my case, I'm going to stick with John and since you'll be able to see my password anyway, I'm going
to go with secret one, two, three.
But please keep in mind that of course, whenever you're setting up your permissions for user, try
to go with something more complex.
Again, it doesn't really matter for me since you'll be able to see it when we set up a connection.
And of course, once I'm done recording the course, I'll change the password.
So again, we are creating a user for the database, not for the entire account.
And after that they ask Where do we want to connect from?
So effectively this is going to be my local environment and as you can see there, right away give you
this option to use the current IP address or it's going to be more advanced and we're going to go with
cloud environment.
And essentially, since we're going to deploy the project, I highly recommend actually whitelisting,
essentially just add the IP address which signals that we can access the project from anywhere because
once we deploy the project, usually on platforms like Render, there is no one set IP address.
Effectively it's changing.
And if you want the project to actually work, then again you'll have to whitelist it over here.
Very, very important.
So in order to do that, we're going to go with 000.
As far as description.
Basically I'll say my connection.
Then let's add and pretty much we're good to go.
And at the very end, we just want to go finish and close.
And once we're done answering the questions, up next, we want to connect to our database.
So I'm not going to spend any time at the moment here in the dashboard since we don't have any data.
So first, let's create the data and then I'll show you the collections and all that cool stuff.
So first we want to click on Connect.
Then we're looking for drivers.
I'm going to go with NodeJS, then version 5.5 or later.
Now don't worry about this NPM install since we'll use the mongoose.
What we're looking for is this connection string.
And essentially once we get it to our project, we'll need to add the password.
Like I said, you'll be able to see my password.
And also here, right after the forward slash, this is where we set up the name for the database.
Now, as far as I remember, if you don't provide the name here, the value, then they automatically
create one.
And I believe they call it test, but I'm not 100% sure.
So effectively, just grab this copy, then navigate back to the project.
We already have Dot EMV and this is where we want to create another environment variable.
And this is the important one.
This is the one we definitely don't want to share when we set up our source control.
Basically when we're pushing this up to a GitHub.
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
set it equal to then copy and paste.
And like I said, first we need to provide the password.
If you remember my one was secret.
One, two, three.
Again, remember we're talking about a user which is accessing the database.
So I'm not accessing the entire account, I'm just accessing that one specific database.
And then as far as the name, I'm just going to go here with Shopify, all uppercase, let's save it.
And before we start discussing our next topic, I also want to quickly show you the extension, the
dot env extension, which sets up the keys in a different color than the value.
Just in case you're interested.
So make sure you create the account, Make sure you set up a user.
You also have the correct connection.
Again, I'm basically allowing access from anywhere and also grab the connection string, make sure
to add a proper password.
And I also provided my own database name.
And once you have completed all of these steps, we can move on to the next topic.