【发布时间】:2020-12-11 20:45:15
【问题描述】:
我正在尝试为 MongoDB 实现搜索功能,这是我正在使用的聚合管道:
[
{
'$search': {
'text': {
'query': 'albus',
'path': [
'first_name', 'email', 'last_name'
]
}
}
}, {
'$project': {
'_id': 1,
'first_name': 1,
'last_name': 1
}
}, {
'$limit': 5
}
]
该命令返回仅包含 albus 或 Albus 的文档,但对于 alb、albu 等查询不返回任何内容。在我在这里观看的演示视频中:https://www.youtube.com/watch?time_continue=8&v=kZ77X67GUfk,讲师是能够根据子字符串进行搜索。
我目前使用的搜索索引是默认的动态索引。 我需要如何更改我的命令?
【问题讨论】:
-
this 回答你的问题了吗?
标签: mongodb mongodb-atlas-search