Using Webpack with Mongoose - mongoose.model is not a function

后端 未结 1 734
闹比i
闹比i 2020-12-12 07:29

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
            


        
相关标签:
1条回答
  • 2020-12-12 08:16

    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

    0 讨论(0)
提交回复
热议问题