【发布时间】:2021-02-18 00:51:39
【问题描述】:
await User.find({ username: new RegExp(keyword, 'i')}).select('-password')
.then((profile)=>{
if(!profile){
res.json({
status: false,
message: 'No profiles found'
})
这是一个单一的搜索。我想一起搜索用户名、组织和全名。怎么可能?
await User.find({ username: new RegExp(keyword, 'i') full_name: new RegExp(keyword, 'i'), organisation: new RegExp(keyword, 'i')}).select('-password')
此代码无效
【问题讨论】:
标签: node.js mongodb mongoose search