我正在尝试获取结果的 throw model.find() 但它向我显示了此错误消息
MongooseError:Model.find() 不再接受回调
1. const Movie = mongoose.model('Movie', moviesSchema);
2. app.get('/', (req, res) =\> {
3. Movie.find({}, function(err, movies) {
4. res.render('index', {
5. moviesList: movies })
6. })})
7. app.listen(4000, function() {
8. console.log('server is running');
9. })
你可以用它作为承诺
Movie.find({}).then(movies => {
res.render('index', {
5. moviesList: movies })
})