I have the following type of object in my MongoDB
{
...,
"name": {
"en": "...",
"am": "...",
"ru": "..."
},
...
}
Now I want to run the following query using Spring Data Mongo
db.categories.aggregate({$addFields: {'name': '$name.am'}})
where the am
part in $name.am
is the locale of the name, hence it must be dynamic. I looked through the MongoTemplate API, and as far as I found, there is no support of addFields
operation. Is there any way to achieve this?