Skip to content

TypeError: Cannot read property 'length' of undefined #5896

@cbratschi

Description

@cbratschi

Do you want to request a feature or report a bug?
bug

What is the current behavior?
Mongoose 4.13.6 crashes where 4.11.13 was working fine.

If the current behavior is a bug, please provide the steps to reproduce.

Our schemas are use child schemas. Mongoose accesses a length property which does not exist.

This is the stack trace:

TypeError: Cannot read property 'length' of undefined
at Mongoose._applyPlugins (Z:\git\pharos-node-server\node_modules\mongoose\lib\index.js:486:40)
at Mongoose._applyPlugins (Z:\git\pharos-node-server\node_modules\mongoose\lib\index.js:487:10)
at Mongoose._applyPlugins (Z:\git\pharos-node-server\node_modules\mongoose\lib\index.js:487:10)
at Mongoose.model (Z:\git\pharos-node-server\node_modules\mongoose\lib\index.js:396:10)

Are there breaking changes between those versions concerning child schemas?

What is the expected behavior?
Should not crash.

Please mention your node.js, mongoose and MongoDB version.
Node v8.4.0 and MongoDB 3.8.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions