var ids = ['50478c35889a450000000001', '50478c35889a450000000002'];
var posterIdArray = ['50478c35889a450000000234', '50478c35889a450000000234'];
Post.find({_id: {$in: posterIdArray})
.select({ comments: { $elemMatch: {$in: ids }}})
.exec(function (err, doc) {
console.log(doc.comments); // ['50478c35889a450000000001']
});
//注意:只返回一个评论ID //我需要找到一条帖子,其中一些评论受到id和过滤器的限制