Db is off , but when i login into mogodb, is on again


i have a React and angular app that connect to mongodb.

but it not showing the data.

i have to log in to mongodb, and then my app shows the data.

So before i tell the user to see my app, i have to log in first into mongo db.

i missed something in configuration ?

best regards,
Stev de DEV

Are there any errors in the browser developer console? Are you accessing MongoDB via a microservice that the web calls or directly from the client?

thanks for responding,

i got no error.

this is how i connect Angular to Node JS

and this is how node JS take the data from mongodb

There are a few things to check, firewall set up correctly? Check out this tutorial How To Use MERN Stack: A Complete Guide | MongoDB. Also try to debug the code and read the error if any when it creates the connection.

Please share the steps you take when

What commands you use?

i just log into mongodb website


That’s ODD.

How do you determine that your app is

Do you have a screenshot that shows your app not showing data before and showing data after login in?

this is image empty

this is image with data

Can we see an un-cropped image of the one with empty data?

I took the liberty to check the address and then your backend. your reset-insert-difuse logic possibly has this bug you mention.
it is very sluggish to return data, it is possible you have forgotten to close the response stream after sending data, or a problem with the codesandbox.
you have to call insert once to populate the table, and it seems it works well after that. but this operation gives timeout, again a possible non-closed stream. the difuse operation seems to respond fast so I will assume it is not a read operation problem from mongo.

while writing the above finding, I noticed codesandbox stops the container if idle for a while, and starts a new container if that happens with new responses. this might be directly related to your first empty list issue.

I suggest you try your code on your pc running both backend and frontend (change corresponding addresses) to rule out any cloud service delays. and btw you need to implement a security measure to your back end when you solve the problem. though it does not much, insert operation currently can fill your db infinitely.

post edit: codesandbox goes idle in a few minutes. and whenever you open that page in that idle time, your page first returns an empty dataset, and after another 15-20 sec full data returns showing codesandbox is back online. it fetches data well after that.

1 Like

Thanks, it is Codesandbox pb that is in idle mode.

1 Like

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