Skip to content Skip to sidebar Skip to footer

Using Webpack With Mongoose - Mongoose.model Is Not A Function

I'm using Webpack to use require modules in the browser; however, I'm getting the following error: Uncaught TypeError: mongoose.model is not a function at Object.

Solution 1:

mongoose.model is server side only. On the client/browser there is no model, because the client/browswer has no database connection. You can use mongoose.Document though, in order to keep schemas DRY/isomorph.

http://mongoosejs.com/docs/unstable/docs/browser.html

Post a Comment for "Using Webpack With Mongoose - Mongoose.model Is Not A Function"