mongoose: TypeError: Cannot read property 'length' of undefined in connection/base.js

/Users/vikram/Documents/code/SilverPush/falcon/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/base.js:246
        throw message;      
              ^
TypeError: Cannot read property 'length' of undefined
    at processResults (/Users/vikram/Documents/code/SilverPush/falcon/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1581:31)
    at /Users/vikram/Documents/code/SilverPush/falcon/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1619:20
    at /Users/vikram/Documents/code/SilverPush/falcon/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1157:7
    at /Users/vikram/Documents/code/SilverPush/falcon/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1890:9
    at Server.Base._callHandler (/Users/vikram/Documents/code/SilverPush/falcon/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/base.js:448:41)
    at /Users/vikram/Documents/code/SilverPush/falcon/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:481:18
    at MongoReply.parseBody (/Users/vikram/Documents/code/SilverPush/falcon/node_modules/mongoose/node_modules/mongodb/lib/mongodb/responses/mongo_reply.js:68:5)
    at null.<anonymous> (/Users/vikram/Documents/code/SilverPush/falcon/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:439:20)
    at emit (events.js:107:17)
    at null.<anonymous> (/Users/vikram/Documents/code/SilverPush/falcon/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:201:13)

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 24

Commits related to this issue

Most upvoted comments

I have the same problem. I tried to update mongoose but nothing works. I’m using mongoose 4.5.9 the latest version. I have the following error: PS C:\node\NodeProjects\retailApp\myApp> node .\index.js C:\node\NodeProjects\retailApp\myApp\node_modules\mongoose\lib\index.js:441 for (i = 0, len = schema.childSchemas.length; i < len; ++i) { ^

TypeError: Cannot read property ‘length’ of undefined at Mongoose._applyPlugins (C:\node\NodeProjects\retailApp\myApp\node_modules\mongoose\lib\index.js:441:40) at Mongoose.model (C:\node\NodeProjects\retailApp\myApp\node_modules\mongoose\lib\index.js:347:12) at module.exports (C:\node\NodeProjects\retailApp\myApp\models.js:11:11) at Object.<anonymous> (C:\node\NodeProjects\retailApp\myApp\index.js:4:20) at Module._compile (module.js:410:26) at Object.Module._extensions…js (module.js:417:10) at Module.load (module.js:344:32) at Function.Module._load (module.js:301:12) at Function.Module.runMain (module.js:442:10) at startup (node.js:136:18) at node.js:966:3