【发布时间】:2020-05-14 14:20:43
【问题描述】:
const UserSchema = new mongoose.Schema({ 名称:字符串, 项目名称:字符串 });
const User = new mongoose.model("User", UserSchema);
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Search</title>
</head>
<body>
<form action="/" method="post">
<input type="text" name="txt">
<button type="submit" name="button" >Search</button>
</form>
</body>
</html>
我希望如果项目名称是“机器学习和 oops”,并且我在搜索框中搜索“oops”,我应该会显示“机器学习和 oops”
【问题讨论】:
-
搜索api使用正则表达式
-
这能回答你的问题吗? How to query MongoDB with "like"?