参数
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
})

sourcenode
307 声望29 粉丝

以少聚多,持之以恒!