Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

ivkeMilioner
ivkeMilioner

Posted on • Edited on

     

Anbody working with MERN? I have error.

I have a problem with reading data from mongo. I can't find the problem. I get an empty array from mongo.

https://github.com/dragoslavIvkovic/MERN-WOLT/tree/master

Top comments(12)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
dawnind profile image
Mainak Das
Student, eager to learn new technologies.
  • Email
  • Location
    Kolkata, India
  • Education
    Graduate in Bachelor's of Technology in Computer Science Engineering
  • Joined
• Edited on• Edited

Elaborate ?
Add help as tag also

CollapseExpand
 
ivkemilioner profile image
ivkeMilioner
  • Location
    Beograd
  • Joined

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...

CollapseExpand
 
dawnind profile image
Mainak Das
Student, eager to learn new technologies.
  • Email
  • Location
    Kolkata, India
  • Education
    Graduate in Bachelor's of Technology in Computer Science Engineering
  • Joined

I tried togit 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? :D

Thread Thread
 
ivkemilioner profile image
ivkeMilioner
  • Location
    Beograd
  • Joined

I removed IP restriction

Thread Thread
 
dawnind profile image
Mainak Das
Student, eager to learn new technologies.
  • Email
  • Location
    Kolkata, India
  • Education
    Graduate in Bachelor's of Technology in Computer Science Engineering
  • Joined

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.

Thread Thread
 
ivkemilioner profile image
ivkeMilioner
  • Location
    Beograd
  • Joined

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?

Thread Thread
 
dawnind profile image
Mainak Das
Student, eager to learn new technologies.
  • Email
  • Location
    Kolkata, India
  • Education
    Graduate in Bachelor's of Technology in Computer Science Engineering
  • Joined
• Edited on• Edited

No worries man ;) debugging is always good
Also I checked your DB, there are two tablesfood 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 atmainakdas104@gmail.com 😊

Thread Thread
 
ivkemilioner profile image
ivkeMilioner
  • Location
    Beograd
  • Joined

I sended invite

 
ivkemilioner profile image
ivkeMilioner
  • Location
    Beograd
  • Joined
CollapseExpand
 
davidfree2 profile image
Humberto David Esquerra
Full stack software web developer. Good with JavaScript, Python, Bash, Html, CSS, MongoDB, PostgreSQL. I'm a huge fan of linux and am currently freelancing as a full stack web developer.

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!

CollapseExpand
 
jlong4223 profile image
Jared Long
I’m an Austin based Full Stack 'Saw'ftware Engineer with additional focus in Node.js, React.js, & React Native.
  • Location
    Austin, TX
  • Work
    Full Stack Software Engineer @ Heartland
  • Joined

What’s getting logged from the console log in your ‘foodAction.js’?

CollapseExpand
 
jlong4223 profile image
Jared Long
I’m an Austin based Full Stack 'Saw'ftware Engineer with additional focus in Node.js, React.js, & React Native.
  • Location
    Austin, TX
  • Work
    Full Stack Software Engineer @ Heartland
  • Joined
• Edited on• Edited

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

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

  • Location
    Beograd
  • Joined

More fromivkeMilioner

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp