'Tags search in mongodb-atlas-search
I have a article collection like this:
[
{
"_id": "article_1",
"Tags": ["tag_1", "tag_2"]
},
{
"_id": "article_2",
"Tags": ["tag_2"]
}
]
And I have a tag collection like this:
[
{
"_id": "tag_1",
"Name": "Test"
},
{
"_id": "tag_2",
"Name": "Mongodb"
}
]
I want to search by tag name with $search method like:
$search: {
index: 'Tags',
text: {
query: 'Test',
}
}
Then get result:
[
{
"_id": "article_1",
"Tags": ["tag_1", "tag_2"]
},
]
Can someone help me with this? How can I make this work? Thank you.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
