Schema hasn't been registered for model "Movie".
老师 首页修改成分类关联查询 就报了这个错误
var Movie = require('../db/models/movie')
var Category = require('../db/models/category')
// index page
exports.index = function (req, res) {
console.log(req.session.user)
Category
.find({})
.populate({path:'movies', options: {limit: 5}})
.exec(function(err, categories) {
console.log(categories)
if (err) {
console.log(err)
}
res.render('index', {
title: 'imooc 首页',
categories: categories
})
})
}
求解决。
大家有遇到吗?