这样写代码会报错:
PostModel.findAsync({author:author}).populateAsync('author')
.then(function (posts) {
res.render('posts', {
posts: posts
});
})
.catch(next);
错误为:

bluebird这个库的populate是怎么用的呢?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PostModel.findis not a callback method or even asynchronous soPostModel.findAsyncdoesn't make sense. You shouldn't need to promisify your own classes you should just have your clasess to return promises to begin with.If you have promisified mongoose somewhere:
You can do
populate is not a function of bluebird, it's one of mongooseReference from here
自己顶一下啊 真的不知道怎么搞了
谢邀,没玩过这个库。那我来盲debug好了,23333
那个findAsync 是你自己封装的方法么,这个方法的执行结果返回的是啥?返回结果中有没有populateAsync这个方法?报错说返回结果没populateAsync这个方法