router.get("/VaguePartner", function (req, res, next) {
const keyWords = req.query.keyWords
t_Superior.find().populate("consumer firstsuperior").where("consumer").or([
{ "nickname": { "$regex": keyWords, $options: "$i" } },
{ "phonenumger": { "$regex": keyWords, $options: "$i" } }
]).then(docs => {
res.send(docs)
})
})
I use mongoose virtual fields to join table queries. The associated consumer,nickname and phonenumger are both fields in the consumer table. T_Superior does not exist this field. How can I query it?