I am using Doctrine ODM to make queries to a MongoDB with queryBuilder API.
I would like to know if it is possible to order the result of a query, so that if a condition is met, they are put before.
In sql it would be something like this.
SELECT id, sport, city
FROM matches
ORDER BY
CASE
WHEN sport= 'Football' THEN 1
WHEN city= 'London' THEN 2
ELSE 3
END,
date;
But I don't know how to do it with queryBuilder.