I tried using basic fetch and connecting my react app with MongoDB but it is throwing error. I tried all of possible tutorial but I can’t fix this please help.
Hi @nut_craker and welcome to MongoDB community forums!!
In order to assist you further, could you help us with few information regarding the error that you are facing:
What is the error you are facing while making the connection?
What are the documentations you are following ?
Is the connection working with other drivers or in mongoshell or compass?
The following documents on How to connect the React App with MongoDB would be a good starting point for the development.
I finally figured it out. I had the MONGODB_URI in the environment name for the client in Render. I was supposed to have the name of the Server’s Website on Render.
I am having the same problem. It works fine locally. My app is deployed on Render and the logs on Render say the database is connected. I have been struggling with this for days. Any help would be greatly appreciated.
This is the error (I replace username and password which is stored in my server’s .env file):
index-BuReeJGG.js:74 Fetch API cannot load mongodb+srv://username:pw@cluster0.6aezan4.mongodb.net/Sandals/api/stluciablogs. URL scheme “mongodb+srv” is not supported.
THIS THE LOGIC IN CLIENT:
const baseUrl = ${import.meta.env.VITE_SERVER_URL}/api/stluciablogs;