I'm pretty new to MongoDB and I'm experiencing it with mongoengine. Given this 'User' model where 'bets' is an embedded document list which each element contains a reference to a 'match' document,
{
"_id" : ObjectId("53df77cef4c9610f28cbff14"),
"name" : "Test",
"admin" : false,
"bets" : [
{ "match" : ObjectId("53e1511df4c9610bf52f5b7a"), "expectedResult" : "1" }
]
}
how can I get 'bets' elements, passed to query the matchId?
I tried to do
User.objects.filter(bets__match={'match._id':match.id})
where 'match' is the object I need to filter by but I get an empty array.