I have the following schema:
{
name: String,
phones: [
{
number: String,
type: String
}
]
}
How do I index phones.number
so that I can write something like:
collection.aggregate([{
"$search":{
"compound":{
"should":[
{"autocomplete":{"query":"012345","path":"name"}},
{"autocomplete":{"query":"012345","path":"phones.number"}}
]
}
}
}])
The docs here give an example for an array of strings but not an array of objects.