Connection string in first exercise - questions

When I use the Web IDE I find a number of databases - or that’s my understanding. Example : Sample_airbnb
The connection string looks like
mongodb+server;//sandbox.< green band- what is this>.mongodb.net/myFirstDatabase" --username m001-student
#1 Is the the organization if not how do I find what it is ?
#2 what should be myFirstDatabase - would it be from the sample data I loaded in as in sample_airbnb ?
#3. do I need to add my IP ? If so where ?

Note I tried to connect from Compass but the suggested path includes a different name than the organization name - what is it ?

Thanks !

Hi @Andrew_Watts,

You need to first connect the IDE to your MongoDB cloud database using the srv connection string in order to see the list of the databases using show dbs

The srv connection string looks something like this:

mongosh 'mongodb+srv://sandbox.xxxx.mongodb.net/myFirstDatabase" --username m001-student'

You can find your srv connection string on the MongoDB Atlas Cloud webpage.

And you will find the way to add the IP address while creating the new Atlas cluster.

I hope it helps!

Thanks,
Kushagra

Kushagra_Kesav : Please explain
#1 what is the source of the xxxx in mongosh 'mongodb+srv://sandbox.xxxx.mongodb.net/myFirstDatabase"
#2 What is the source for the sample data for student lessons ? - my web ide shows I have sample data including the database for sample_airbnb

Thanks - I am trying to make sure my environment is understood !

xxxx is a placeholder.It should be replaced with your unique Sandbox cluster id
You would have already got this from Atlas
Please show output of show dbs
You should have all sample DBs
You can use any dbname in connect string even non existent like MyFirstdatabase
Once connected to cluster you can always switch to your desired db by
use db_name

Regarding IP you need to whitelist it
We allow access from anywhere(0.0.0.0)
Steps on how to do this from your Atlas must have been described in your lesson
You can find in our forum threads too

When I log on I see this : cluster0-shard-00-01.tlhb3.mongodb.net:27017 is the whole think the cluster id ?
And yes - I think there are more DBs available -
I also see from the Web IDE this : 0.0.0.0/0 (includes your current IP address). And it shows as active. I also found a db user I created - different from my log on identification which is my email and password ). But I should be using student for the course as I understand it.


By this can I say I am connected with the Web log on , but the student environment is still another connection - is that correct ?

Is the whole string cluster0… to 27017 the clusterID to use ? in the student exercise ?

I think you are using some old connect string from previous course?

You are supposed to create your cluster as sandbox… else your test result will fail
When did you create this cluster?
Either drop this cluster and create new one starting with sandbox and load the sample data
or create another project and create a new cluster under it
The DB that is being used by this course is sample_training
I think it exists under your current cluster.All you have to do is switch to that DB or use that dbname in your connect string which will put you directly into that DB

1 Like