I have a collection as follows,
I want to get the cities for the specific country. what should be the query?
This is what i have tried.
db.getCollection('_event').find([
{$match: {}},
{$project: {
cities: {
$filter: {
input: 'city',
as: 'r',
cond: {$eq: ['$$r.country', 'Portugal']}
}
}
}}
])