Ali2206 commited on
Commit
505bbe6
·
1 Parent(s): 444243b

Fix delete item API MongoDB query - Fix sections.$.items to sections.$[].items for proper array update

Browse files
Files changed (1) hide show
  1. main.py +2 -2
main.py CHANGED
@@ -1031,8 +1031,8 @@ async def delete_checklist_item(user_id: str, item_id: str):
1031
 
1032
  # Remove the item from the checklist
1033
  result = await db.checklists.update_one(
1034
- {"userId": user_id, "sections.items.id": item_id},
1035
- {"$pull": {"sections.$.items": {"id": item_id}}}
1036
  )
1037
 
1038
  if result.modified_count > 0:
 
1031
 
1032
  # Remove the item from the checklist
1033
  result = await db.checklists.update_one(
1034
+ {"userId": user_id},
1035
+ {"$pull": {"sections.$[].items": {"id": item_id}}}
1036
  )
1037
 
1038
  if result.modified_count > 0: