我可以访问userId,我想得到的结果没有文档的特定用户。我怎么能做到这一点在mongoose?
userId
async peopleyoumayknow(req, res) { const {id} = req.params const response = await userModel.find({}).sort({creation_date:-1}).limit(12) return res.send(response) }
iugsix8n1#
将代码更新为
async peopleyoumayknow(req, res){ const {id} = req.params const response = await userModel.find({ _id: {"$ne": id}}).sort({creation_date:-1}).limit(12); return res.send(response) }
1条答案
按热度按时间iugsix8n1#
将代码更新为