Connecting to my MongoDB Database
Hello everyone,
I am struggling to find the reason why I cant connect with my database on MongoDB. This is my first project on java ever and it is going to be an App. I think I have the wrong line of code for the connection I intended to use on MongoDB and I kinda got confused with all the Methods. I am using VS Code and I think using the MongoDB extension on VS is the most practical going forward. So if anyone has some experience working with these tools I would appreciate the help. When trying to run the server this is the error message iI get
` and this is on my root index.js to connect with mongodb: Thank you in advance if you need any more information let me know.
querySrv ENOTFOUND _mongodb._tcp.cluster0.mongodb.net
and this is the line on my .env i am using to connect to MongoDB MONGO_URI=mongodb+srv://mmetinbirguel:[email protected]/Tierlist?retryWrites=true&w=majority
Of course I have my real password instead of just "password" there, for safety reasons I share it like this 😄
this is the database.js I have:` and this is on my root index.js to connect with mongodb: Thank you in advance if you need any more information let me know.
6 Replies
⌛
This post has been reserved for your question.
Hey @Metz! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
do you use maven or gradle?
this look like javascript?
Oh yes this is Javascript hahah oops
wrong server then :kekw:
well, that must be why it dont work well, is your mongodb on your computer?
at 127.0.0.1?
cluster0.mongodb.net?
I am not really sure, i was looking where to check but it was connected to database somewhere else
in Frankfurt
If thats what you mean
Post Closed
This post has been closed by <@743072402702860358> for the following reason:
User left the server