jdx / mean-sample

Sample project for Write Modern Web Apps with the MEAN Stack by Jeff Dickey
https://mean-sample.herokuapp.com
166 stars 90 forks source link

PG 56 - Mongo Connection Issues #48

Open mikevarela opened 8 years ago

mikevarela commented 8 years ago

Hi,

been following along and like the book, though finding some things in final code of chapter that weren't discussed in the section on it, but my issue here is with mongo

I'm installed mongo via npm and mongoose and created the db.js file.

when i try and connect to mongo (using terminal) i get

$ mongo MongoDB shell version: 3.0.5 connecting to: test 2016-04-12T09:19:12.414-0700 W NETWORK Failed to connect to 127.0.0.1:27017, reason: errno:61 Connection refused 2016-04-12T09:19:12.415-0700 E QUERY Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed at connect (src/mongo/shell/mongo.js:179:14) at (connect):1:6 at src/mongo/shell/mongo.js:179 exception: connect failed

Same comes back from using Postman. I've also changed my mongoose.connect from

mongo://localohost

to

mongo://127.0.0.1

just in case - with no help

mikevarela commented 8 years ago

Needed to start Mongo with homebrew first...

brew services start mongodb

mikevarela commented 8 years ago

UGH, now still having validation errors

ValidationError: Post validation failed at MongooseError.ValidationError (/Users/Mike//node_modules/mongoose/lib/error/validation.js:22:11) at model.Document.invalidate /Users/Mike//node_modules/mongoose/lib/document.js:1347:32) at /Users/Mike//node_modules/mongoose/lib/document.js:1214:17 at validate (/Users/Mike//node_modules/mongoose/lib/schematype.js:693:7) at /Users/Mike//node_modules/mongoose/lib/schematype.js:724:9 at Array.forEach (native) at SchemaString.SchemaType.doValidate /Users/Mike//node_modules/mongoose/lib/schematype.js:698:19) at /Users/Mike//node_modules/mongoose/lib/document.js:1212:9 at nextTickCallbackWith0Args (node.js:452:9) at process._tickCallback (node.js:381:13)

imranfarid commented 7 years ago

I am facing similar error. Any solution?!