使用mongoose进行多表联查,为什么会报错
Article.find().populate('author', { password: 0, username: 1, nickname: 1, tag: 1 })
.limit(1).exec().then((r) => {
console.log(r);
console.log('查询成功');
})
但是下面代码就不会报错
Article.find().populate('author', { username: 1, nickname: 1, tag: 1 })
.limit(1).exec().then((r) => {
console.log(r);
console.log('查询成功');
})