【发布时间】:2018-04-23 04:48:29
【问题描述】:
考虑以下代码:
Transactions: [
{name: 123, content: "Starbucks Coffee"},
{name: 456, content: "Peets Coffee"},
{name: 789, content: "Amazon gift card"},
{name: 646, content: "amazon gift card"},
{name: 779, content: "Acme Corp deposit cheque"},
{name: 606, content: "acme corp deposit cheque"},
{name: 879, content: "Dunkin-Donuts"},
{name: 656, content: "Dunkin Donuts"}
];
我需要编写一个 MongoDB 框架,它执行以下操作:
案例 1.)
输入:“Acme Corp”或“acme Corp”或“Acme corp”或“acme corp”
预期输出:
[
{name: 779, content: "Acme Corp deposit cheque"},
{name: 606, content: "acme corp deposit cheque"}
]
案例 2.)
输入:“亚马逊”或“亚马逊”
预期输出:
[
{name: 789, content: "Amazon gift card"},
{name: 646, content: "amazon gift card"}
]
案例 3.)
输入:“Dunkin”或“dunkin”或“Dunkin-Donuts”或“dunkin-donuts”或“dunkin-Donuts”或“Dunkin-donuts”或“donuts”或“Donuts”
预期输出:
[
{name: 879, content: "Dunkin-Donuts"},
{name: 656, content: "Dunkin Donuts"}
]
谢谢!任何帮助将不胜感激。
【问题讨论】:
-
您在 Google 搜索中的问题标题 https://www.google.com/search?q=Text+Search+in+MongodDB 会返回您在发布之前应该阅读的所有相关链接。
标签: javascript mongodb nlp keyword-search