参数
const val = req.body.val;
const reg = new RegExp(val, 'i');
Model.find({
$or: [{ key1: {$regex: reg} },
{key2: {$regex: reg} },
{key3: {$regex: reg} }
]
}).sort({timestamp: -1}).exec((err, docs) => {// do something})
参数
const val = req.body.val;
const reg = new RegExp(val, 'i');
Model.find({
$or: [{ key1: {$regex: reg} },
{key2: {$regex: reg} },
{key3: {$regex: reg} }
]
}).sort({timestamp: -1}).exec((err, docs) => {// do something})