There is a way to filter (or query) an array structured like this:
[ {
'xml:id': 'Name1',
sex: {
'$t': 'M'
},
occupation: {
n: 1,
'$t': 'bank'
}
},
{
'xml:id': 'Name2',
sex: {
'$t': 'M'
},
occupation: {
n: 1,
'$t': 'writer'
}
}, {
'xml:id': 'Name3',
sex: {
'$t': 'F'
},
occupation: {
n: 1,
'$t': 'bank'
}
}, {
'xml:id': 'Name4',
sex: {
'$t': 'M'
},
occupation: {
n: 1,
'$t': 'writer'
},
}, {
'xml:id': 'Name5',
sex: {
'$t': 'M'
},
occupation: {
n: 1,
'$t': 'writer'
}
}
]
whit a query of this type:
const pers_query: Query = {
type: 'person',
args: [
{
key: 'occupation',
value: 'bank',
},
{
key: 'sex',
value: 'f',
},
],
};
What I want is to filter the data with multiple keys and values, in this specific case I want to filter the data for all the occurrences of object that contains the key sex with value f AND the key occupation with value bank
the result should be something like this:
[
{
'xml:id': 'Name3',
sex: {
'$t': 'F'
},
occupation: {
n: 1,
'$t': 'bank'
}
}
]