在mongoose中使用正则,参数为变量时的写法

const word = ctx.params.word

userModel.find({"name":{$regex: eval(`/${word}/ig`)}})

猜你喜欢

转载自www.cnblogs.com/qiyc/p/9170501.html
今日推荐