I try to query the following:
app.get("/api/leagues/:leagueId/:fixtureDate", async function (req, res) {
const result = await client.db("db").collection("matches").find({
$and: [
{ "date": req.params.fixtureDate },
{ "league.id": req.params.leagueId }
]
}).toArray();
res.send(result);
});
League object looks like this:
"league": {
"id": 2,
"name": "UEFA Champions League",
"country": "World",
"logo": "CL.png",
"flag": null,
"season": 2024,
"round": "1st Qualifying Round"
}
But it returns an empty array [] when it should return fixtures that match the query filter
I experimented around a little bit and found that the problem has something to do with league.id, The server does receive the parameters from the frontend fine so it’s not that nor a typo mistake.