如何从 mongoDB 的标题中找到关键字?从包含一个或多个单词的标题中查找关键字。// data{ title: "hello my name is joy", section_name: "talk", category_path: "info"}//From Keyword collection[ {keyword: "hello", section_name: "talk", category_path: "info", username: ["joy", "sadness"]}, {keyword: "hello joy", section_name: "talk", category_path: "info", username: ["joy"]}, {keyword: "shoes", section_name: "market", category_path: "sell", username: ["joy"]}]这是我想去获取数据。// the Result[ {keyword: "hello", section_name: "talk", category_path: "info", username: ["joy", "sadness"]}, {keyword: "name joy", section_name: "talk", category_path: "info", username: ["joy"]}]我试过这段代码// No Datadb.getCollection('keyword').find({"keyword": {$regex: "hello my name is joy"}, "section_name":"talk", "category_path": "info"})
- 1 回答
- 0 关注
- 97 浏览
添加回答
举报
0/150
提交
取消