I have a problem with reading data from mongo. I can't find the problem. I get an empty array from mongo.
For further actions, you may consider blocking this person and/or reporting abuse
I have a problem with reading data from mongo. I can't find the problem. I get an empty array from mongo.
For further actions, you may consider blocking this person and/or reporting abuse
Vishesh Tiwari -
Rodion -
Spencer Marx -
A0mineTV -
Top comments (12)
Elaborate ?
Add help as tag also
That is problem. I can't find where is problem. I getiing empty array from mongo database. In this file I geting only "Loading"
github.com/dragoslavIvkovic/MERN-W...
I tried to
git clone
the repo and starting to debug but found mongo connect error/ timeout? Will that be the problem? I'm guessing not. Can you remove the IP restrictions (if any) so that I can debug further? :DI removed IP restriction
I checked the logs, the thing you were doing was not connecting the DB to the running server. As a result DB is running its own and server in its own. Second thing you need to add CORS to enable API access from other domains.
Tried to push the updated code, but blocked.
Thank you to heaven for spanindg your time on me. Thank you to heaven for wasting your time on me. Can you email me an update?
No worries man ;) debugging is always good
Also I checked your DB, there are two tables
food
andfoods
. TheFood.find({})
is accessing thefood
table. You may have to check that to get the required values from the correct table i.efoods
.Can you ping me at mainakdas104@gmail.com 😊
I sended invite
ivkemilioner2@gmail.com
My advice would be to checkout w3schools use of mondgodb. They don't use mongoose they use the official mongodb npm driver. Also try to keep everything in your database.js file and add function arguments to fetch specific collection documents by name. My last advice would be make sure the data your sending to client is a resolved promise. If it isn't a resolved promise your gonna need another call back to resolve the data in the frontend. Good luck! Hang in there!
What’s getting logged from the console log in your ‘foodAction.js’?
It could potentially be related to your action dispatching GET_FOODS_REQUEST, which sets loading to true but that dispatch doesn’t contain any new state. I wonder if your try/catch is being ran