I am trying to build a MERN stack application. I am using MongoDB Atlas. I have a collection named test under which I have a database called test also. Here is my URL:
When I try to establish connection, it says connection failed. May I know my error?
Most video tutorials show the MongoDB URL with a supposedly pre-made database name called “test”, but I noticed nowadays one has to put it. So I just created one.
I copied it but I guess it is not being shown as I don’t know the correct syntax for posting such content. Anyway, my URL looks like your one. As of now, I have a test and collection named “test”. Now I guess you know. Thanks.
When you enter a code block into a forum post, precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor ( </> ) to add backticks around text.
Cluster is mern. Collection and Database both is test. Still it refuses connection when I try with npm start and check console. However when I try with node server.js it says connection established however my get and post request failed. I guess I have a problem connecting with the database.
As suggested by @Minsky you need to include the full error message and the code you are using to connect and make a POST/GET request to the database. It will be easier to help.