Server Fails with Cannot read property 'length' of undefined
popescunsergiu opened this issue · 4 comments
popescunsergiu commented
node bin/www
##############################################################
#
# !!! MONGOOSE WARNING !!!
#
# This is an UNSTABLE release of Mongoose.
# Unstable releases are available for preview/testing only.
# DO NOT run this in production.
#
##############################################################
info: [bin/www] Express server listening on port 1337
info: [db/mongoose.js] Connected to DB!
/Users/sergiu/SrgSolutions/NodeAPI/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/base.js:246
throw message;
^
TypeError: Cannot read property 'length' of undefined
at processResults (/Users/sergiu/SrgSolutions/NodeAPI/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1581:31)
at /Users/sergiu/SrgSolutions/NodeAPI/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1619:20
at /Users/sergiu/SrgSolutions/NodeAPI/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1157:7
at /Users/sergiu/SrgSolutions/NodeAPI/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1890:9
at Server.Base._callHandler (/Users/sergiu/SrgSolutions/NodeAPI/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/base.js:448:41)
at /Users/sergiu/SrgSolutions/NodeAPI/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:481:18
at MongoReply.parseBody (/Users/sergiu/SrgSolutions/NodeAPI/node_modules/mongoose/node_modules/mongodb/lib/mongodb/responses/mongo_reply.js:68:5)
at null.<anonymous> (/Users/sergiu/SrgSolutions/NodeAPI/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:439:20)
at emit (events.js:107:17)
at null.<anonymous> (/Users/sergiu/SrgSolutions/NodeAPI/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:201:13)
MrLoga commented
at-home commented
Just change the version of Mongoose to the latest release:
"mongoose": "4.2.7"
run "npm install" again followed by "node generateData.js"
ealeksandrov commented
Should be resolved now
tramel-woodard commented
Had the same issue. Even with no restrictions on other modules and updated versions, limiting the mongoose version to 4.2.7 seems to do the trick.