I have the collection below and would like to return all matches where firstParticipant.address or secondParticipant.address = 789 how to make this query with the mongoose and return only the objects that match the filter?
My document:
{
"_id": "25113",
"title": "Jogo de futebol",
"rounds": {
"matches": [{
"firstParticipant": {
"address": "789",
"battlesWon": 0
},
"secondParticipant": {
"address": "748569874",
"battlesWon": 0
}
},
{
"firstParticipant": {
"address": "963",
"battlesWon": 0
},
"secondParticipant": {
"address": "741",
"battlesWon": 0
}
},
{
"firstParticipant": {
"address": "258",
"battlesWon": 0
},
"secondParticipant": {
"address": "789",
"battlesWon": 0
}
}
]
}
}
Expected result:
expected result:
[{
"firstParticipant": {
"address": "789",
"battlesWon": 0
},
"secondParticipant": {
"address": "748569874",
"battlesWon": 0
}
},
{
"firstParticipant": {
"address": "258",
"battlesWon": 0
},
"secondParticipant": {
"address": "789",
"battlesWon": 0
}
}
]