Skip to content

Commit db38b17

Browse files
authored
Update patients.py
Group by disease/condition try fixed with "id": "$_id" ✅
1 parent 3ea09d6 commit db38b17

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

routers/patients.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ async def group_patients_by_disease(current_doctor: str = Depends(get_current_do
4646
{"$group": {
4747
"_id": "$diagnoses_history.disease", # Group by disease name
4848
"patients": {"$push": {
49-
"id": "$id",
49+
"id": "$_id",
5050
"name": "$name",
5151
"city": "$city",
5252
"age": "$age",
@@ -71,7 +71,7 @@ async def group_patients_by_condition(current_doctor: str = Depends(get_current_
7171
{"$group": {
7272
"_id": "$diagnoses_history.condition", # Group by condition
7373
"patients": {"$push": {
74-
"id": "$id",
74+
"id": "$_id",
7575
"name": "$name",
7676
"city": "$city",
7777
"age": "$age",

0 commit comments

Comments
 (0)