doesn't make me create a cluster!

Hi everybody, i started to study mongodb and mongoose, in this lesson, but when i follow the tutorial and after registring on when i have to create a cluster, it stopped on the loading, the message:
M0 Cluster Provisioning... This process will take 3-5 minutes. stay in the page and the website doesn’t create any cluster, i don’t know if it’s my own problem but i ve good wifi and my pc works quite good, i really don’t understand why it doesn’t make me create a cluster, i’ve repeated the process with 3 different email, hope you can help me.

I’ve used your Replit starter project, i’ve succesfully added mongodb and mongoose in the json, now i’ve to connect the database; my question is, in the lesson you told Create a .env file and add a MONGO_URI variable to it. now i’ve understood how to create a secret variable, i’ve understood that the key of the variable is MONGO_URI but what about the value? into the web i’ve found that the variable should be equal to mongodb://localhost:27017/mydbname i ask you if this last point is correct or not.

That all depends to where you are hosting your db.

That string, is the connection point that your app will try to connect to to instantiate a communication with the DB.

I think that a mongoDB running on mongoAtlas, which is a managed cloud service, has a connection string like:


(where of course you need to sub the values with the correct one).

But if you were to have mongo running locally on your machine then of course the connection string would be different.

So the question is: where is the db hosted?

edit: probably worth mentioning that the .env file make sense when working with node and dotenv.
If you are running your project on Replit then they support a different methods for secrets and env variables:

the db is hosted here on replit, if it’s the string value:

to add to the key MONGO_URI, my only last question is: if the website itself ( doesn’t make me create a cluster, how i should do? the only thing it’s try to create it another time i think

because the string value that you wrote includes the cluster, but the website doesn’t let me create it, and i absolutely don’t know why :thinking:

I don’t think Replit hosts the db, and if they do… chapeau to their dev team :slight_smile:

Replit host and run your code, but the data, the data is another story.
You need to have a working DB server for that.

As you pointed out FCC suggest to create a MongoDB Atlas account, and host your db there.
That’s an external provider that has nothing to do with FCC. So i suggest to go over the mongoDB docs and see that you are all set up

If you still experience errors, then you need to provide more information that that.
Did you experience any errors?

Looking @ mongo seems all their infra is operational

Thank you i’ve solved, i managed on create the cluster! i don’t know why but when i create it the first time, the page stay on the loading of creating the cluster itself, now i got it, and i too got my URI, obviously similar to your one! Thank you anyway! now i put the uri in the secret variable. and hope i can connect the database ^^

1 Like

I got i hope the last question, the uri string:
mongodb+srv://<username>:<password>@<clustername><database> must be manipulated like you said, i know the username and the password obviously, but not the database’s name, on it give the name myFirstDatabase that must be replaced, just like your string, but honestly i don’t know where it is, when i go to the ‘‘Database Access’’ on there i can find the username and the password, but not the database’s name. can you please tell me where can i find it?

here’s my actual replit[edited]

Did you follow the steps in “Connect to your cluster” in the article you linked to?

Connect to your cluster

  • Click on the green Get Started button in the bottom left of your screen should now show you the final step, Connect to your cluster , click on it.
  • On the left side of the screen, click on Clusters .
  • Click the Connect button for your cluster.
  • In the popup modal, click on Connect your application .
  • You should see the URI you’ll use to connect to your database similar to this: mongodb+srv://<username>:<password>@<cluster-name><db-name>?retryWrites=true&w=majority .
  • Click the Copy button to copy your URI to your clipboard.

Yes, i’m arrived at this point, i made an error that consist in replacing even the text myFirstDatabase, anyway i took the URI like you told in your screenshots and i only replaced the password, to connect the database i’ve tryed 2 ways following the lesson: the first is fill the variable MONGO_URI with the value of my URI, this variable is already present in the file sample.env into my app, and then i added in myApp.js the following code:

const mongoose = require('mongoose');

and it didn’t work, the other way is that i wrote in myApp.js the following code:

mongoose.connect(<Your URI>, { useNewUrlParser: true, useUnifiedTopology: true });

replacing Your URI with the copied URI in like you showed me, and neither this way worked. I am stopped here, i hope for your additional help!

  1. The password shouldn’t have brackets <> around it.

  2. It is a string so remember to open and close it "".

  3. The start and end of the connection string are not inside brackets <>.

mongoose.connect("mongodb+srv://", { useNewUrlParser: true, useUnifiedTopology: true });
  1. In version 3 you did not require in mongoose.
const mongoose = require("mongoose");
  1. White list all IPs ( to avoid issues.

Also what Replit are you working on now, version 3?

When you are done with this. I’d suggest you create a new password as you have posted your connection string in the Replit. This is fine for now but is otherwise something you should never do in a project.

1 Like

Thanks for all, i’ve solved it :smiley: thank you even for your last hint about the password, but it’s anyway an unsual password for me, but i will take the advice for the next time, i wish you a great day! now i rest :joy:

No problem, happy to help. Enjoy your rest. :sleeping:

It isn’t about next time. It is about the DB you have now. You don’t want people to be able to use it (or abuse it). Anyway, it’s just not something you want to put out in the open. This is why we use the .env file and do not commit it to Git.

yeah,it’s logic putting strings that includes passwords into secret variables, but this way:

seems don’t work, maybe for the replit version i use, and i don’t know what specifically it is but without your help i think i’d stay on this lesson at least another day. I’m so happy i did it! hope i can build my own pro-website soon :joy: good evening, time to sleep here in Italy :wave:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.