Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Databases

Cannot make a mongodb connection

I am new to mongoDB. I am a student trying to complete an exercise. I need to connect to a mongo database and seed that database with starter data. There is more to the project but I will tackle that when I get the connection/seeding problem solved.

Here are the environment particulars:

  • mongo -- version 3.6.2 installed with brew
  • macOSX High Sierra 10.13.3
  • app written in node/express
  • seeder is the npm package used for seeding (in theory anyway)
  • IDE -- VSCode using Integrated Terminal as a CLI
  • Just for thoroughness, restarted mongo by brew services restart mongodb
  • start script = npm start ("nodemon ./start")
  • link to the gist file: https://gist.github.com/dhawkinson/374e6e4cb79fb1eb2b8db11ede2af4b3

I get the following two console.logs

Express server is listening on port 5000
courseRatingDB connection established

which you can see in the gist, but I get nothing else, no errors thrown, no syntax errors, no connection, no seeding. Can anyone tell me why, and how to fix it?

4 Answers

I finally solved this problem. I quite trying the use the npm module mongoose-seeder and used mongoose-seed instead.

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Doug;

Were you able to get this resolved?

Ken

No I was not.

Ken Alger
Ken Alger
Treehouse Teacher

Hmmm... okay. I'll see if I can get anything going on my end.

Thank you.