Closed lukebelliveau closed 2 years ago
Aha, yeah, that makes sense. I'll work on this today. I forget, do you have experience with mongo and mongoose?
I'm a little hazy on how all of the following parts fit together, so bear with me. I think you need to have either mongosh or mongod running in the background for index.js to connect to the DB with the following lines (31-34)
mongoose.connect('mongodb://localhost:27017/beacon', { useNewUrlParser: true, useCreateIndex: true });
Could that be it? Are you currently running the mongo shell? If not, I believe you can start it up with mongosh and then maybe the app will connect properly? Let me know if I'm on the right track. Thanks for your help!!
Got it!
You were correct - the MongoDB server was not running. I think in most cases running mongod
with MongoDB installed should do it.
I had some maybe Mac-specific issues that were resolved by doing this: https://stackoverflow.com/a/58297378/3124493
I'd suggest an addition to the README - include a link for instructions to install/run MongoDB, indicating that the MongoDB server must be running to run Beacon.
Excellent, thanks! And thanks for the links, I made your suggested changes to the README. Also discovered I can use VSCodes source control tab to easily push/pull changes to GitHub.
Issue Cannot start application due to mongoDB error on start
Expected behavior Application starts with command
node index.js
Actual behavior Application has a mongoDB connection error when starting application
Steps to reproduce
$ git clone https://github.com/Beacon24/v0.git
$ cd v0
$ npm install
$ node index.js
See the following error in the console:
Notes It seems like your
index.js
script expects a mongoDB server to be running atlocalhost:27017
. Please edit your README.md file with instructions on how to start up your database. Hit me up with any questions.