Mongoose Model.find is not a function?

后端 未结 5 922
温柔的废话
温柔的废话 2020-12-15 19:40

Spent hours trying to figure this out - I\'m adding a new Model to my app but it\'s failing with \"TypeError: List.find is not a function\". I have another model, Items, th

5条回答
  •  青春惊慌失措
    2020-12-15 20:21

    You've defined incorrect module.exports.

    mongoose.exports = mongoose.model('List', listSchema);

    This should be

    module.exports = mongoose.model("List", listSchema);

提交回复
热议问题