'mongodb $search two collections holding geoJSON
I am trying to work out how to do $text search on 2 collections at the same time and show them to the end user.
I have a collection called suburbs and a collection call LocalAreas the reason being that local areas are City boundaries while Suburbs are suburbs of that area.
Now lets say I want to type Perth
It should lookup both collections for the word Perth
I have added search index on and I know I can do this
for Suburbs I can do this.
[
{
$search: {
index: 'Suburbs',
text: {
query: 'Perth',
path: {
'wildcard': '*'
}
}
}
}
]
But how do I do this for both collections at the same time?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
