With my cluster up and running, we can now work with the cluster. On the cluster here, we get a couple
of options to migrate data into the cluster for example, to pause it, to terminate it,
you can check out general metrics about your cluster and see all kinds of information of what happened
on your cluster, how many reads you had and so on,
you can also dive into the collections your cluster has,
so you see databases and the collections in the cluster and some of these options might only be available
outside of the free tier by the way,
so I'll not dive too deep into that,
definitely just click around there and play around.
For now, the interesting part is how can we connect to the cluster
and for this we can click on the overview page, we can click on connect here. Now
there you see the IP addresses that will be able to connect and you can also add an entry from here
but that's the same list we had on the IP whitelist page earlier
and then you should choose your way of connecting.
Now I will go with the shell, in another module in this course later we'll of course also connect from an application
so that we can really use that in an app as it could run on a real server, so I'll connect with mongodb
shell.
Now you can follow the instructions here for your operating system, download the shell of course,
we already have it
so you can skip that step and then connect with this command here.
So you should be able to just copy that command,
you'll need your password, so make sure you also have that saved somewhere,
copy that command here
and now let's switch to the shell again.
Now first of all you need to quit a running shell,
you can also quit a running mongod instance on your computer,
you don't need to run a server anymore,
we have one in the web now.
And now to connect to the mongodb cluster,
you can insert a command you just copied
and the important thing here is that we have now
mongo still
but then we have this path here and this ensures that mongo does not try to connect to a locally running
mongodb server which would be its default behavior but that it instead tries to reach a server
at this address.
/tests here by the way defines the default database to which you connect,
so you can change this if you want, so you can also set
I want to connect to
let's say /products here.
You then need to add your username with --username and you can hit enter and you should be prompted
for your password then.
Now make sure you now enter the password you chose when creating the user with which you were trying
to log in
and it should then connect to your mongodb server running in the cloud,
so I'm now connected to this cloud.
If I show my dbs, we again is the admin config local there and now of course, I should already be in products
but we can also use that again or use shop maybe and then there, use db products
insert one and there I can enter a book and a price and if I hit enter, this is now inserted and everything here works
as you learned it in the course. This does not differ, it's a normal mongodb server in the end,
just one running in the cloud and not running on your computer and you can interact with it as you
did with your local server but now, you've got a perfectly configured, highly performant mongodb
server deployed in the cloud
and since it's in the cloud now, so on a server and not on your local host,
you can now use it from anywhere and not just your local machine.