From 2b37533d9def918a87085e1b28dc0796760d9aef Mon Sep 17 00:00:00 2001 From: Alix JEUDI--LEMOINE Date: Thu, 29 May 2025 17:30:34 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20bug=20top=20users=20were?= =?UTF-8?q?=20not=20correct?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/routes/admin.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/routes/admin.py b/app/routes/admin.py index c76a3dd..0901a55 100644 --- a/app/routes/admin.py +++ b/app/routes/admin.py @@ -95,8 +95,10 @@ async def get_stats(admin_user: User = Depends(get_admin_user)): top_users = list(users_collection.aggregate([ {"$lookup": { "from": "pins", - "localField": "_id", - "foreignField": "user_id", + "let": { "user_id": { "$toString": "$_id" } }, + "pipeline": [ + { "$match": { "$expr": { "$eq": ["$user_id", "$$user_id"] } } } + ], "as": "pins" }}, {"$project": {