Metz
JCHJava Community | Help. Code. Learn.
•Created by Metz on 11/26/2024 in #java-help
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.
14 replies