I am using MongoDB atlas search. How can I assign a score for one field based on the value in another field? In the below example I have an array of objects called tags with two properties - name and tag_category. The data structure is like this in MongoDB.
{
“_id”:ObjectId(“6094e1dd0ac22244fd1cd5c3”),
"tags":[
{
"name":"India",
"tag_id":"6094e1bb72bff620f43b0f77",
"tag_category":"region"
},
{
"name":"something else",
"tagid":"aaaae1bb72bff620f43b0faa",
"tag_category":"general"
}
]
}
I want to have a score of 15 for tags.name when tags.tag_category is “region” and score of 5 when tags.tag_category is “general” when query matches search result.
How can I achieve this? Any help is appreciated