【发布时间】:2021-01-01 18:55:14
【问题描述】:
我有以下架构:
{
name: String,
phones: [
{
number: String,
type: String
}
]
}
我如何索引phones.number 以便我可以写如下内容:
collection.aggregate([{
"$search":{
"compound":{
"should":[
{"autocomplete":{"query":"012345","path":"name"}},
{"autocomplete":{"query":"012345","path":"phones.number"}}
]
}
}
}])
文档here 给出了字符串数组的示例,但没有给出对象数组的示例。
【问题讨论】:
-
自动完成也不是数组的有效索引定义,afaik,
标签: mongodb mongodb-atlas mongodb-atlas-search