From 157ddef1b75a5bdf54e0d182f2e17e8a466ce4d0 Mon Sep 17 00:00:00 2001 From: Muhammad Faraz Maqsood Date: Thu, 17 Oct 2024 14:38:18 +0500 Subject: [PATCH] fix: convert parent_id to ObjectId - We were not able to get child comments as mongo was expecing parent_id as ObjectId to get list of child comments associated with the respective parent_id(ObjectId). --- forum/backends/mongodb/api.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/forum/backends/mongodb/api.py b/forum/backends/mongodb/api.py index 3f2b9879..fd72a6b2 100644 --- a/forum/backends/mongodb/api.py +++ b/forum/backends/mongodb/api.py @@ -1479,6 +1479,8 @@ def get_comments(**kwargs: Any) -> list[dict[str, Any]]: """Return comments from kwargs.""" if "comment_thread_id" in kwargs: kwargs["comment_thread_id"] = ObjectId(kwargs["comment_thread_id"]) + if parent_id := kwargs.get("parent_id"): + kwargs["parent_id"] = ObjectId(parent_id) return list(Comment().get_list(**kwargs))