Closed HellMagic closed 9 years ago
Which version of Mongoose and mongoose-deep-populate are you using?
Hi, I am also seeing this problem. I just upgraded mongoose-deep-populate to 2.0.0 and it's having the same problem as above when used with mongoose 4.1.3 (latest as of now).
process.nextTick(function() { throw err; }) ^ TypeError: Cannot read property 'prototype' of undefined
Downgrading back to 1.1.0, until there is a fix. I tried to define it in the schema as a plugin, same as in 1.1.0, but I get that error. Please fix
Did you load mongoose-deep-populate correctly per 2.0 breaking change? That is:
var deepPopulate = require('mongoose-deep-populate')(mongoose)
Thanks ---I missed that. Should be in BIG BOLD RED letters! lol ;)
Agreed. I'll highlight that.
Flow the prompt to check the lib/plugin.js, then there is the code
but, as if there is no mongoose.Query object in mongoose 4.0.1(may be 4.x.x), so it throw error: "Cannot read property 'prototype' of undefined"--as the code, mongoose.Query not be checked if it is null。but the version @1.1.0 is work for mongoose 4.x.x, may be because the dependence is mongoose@>=3.6.0, but @2.0.0 the is depend on mongoose@>4.0.0 so, wish it is help, and expect to fix it , mongoose-deep-populate is awesome work~