Adjacent List pattern querying

Am storing threaded comments as separate documents (for ease of UI use), and need to return the comment list in threaded order (each root followed by sub,sub,sub comments in correct order for indented display).
Someone I’m sure has done this…is there a way to efficiently do this?

Example: Records with parentId=null are off root, otherwise reference their parent. Id field is not valid to use for ordering (uuid), and datetime is available but doesn’t help in getting to a threaded ordering.

upsert INTO mybucket (KEY,VALUE) VALUES (“key1”, { “kind”:“trycomment”,“id”:“1”, “commentText”:“on root”, “parentId”:null, “dt”:“2020-02-03 09:02:00Z”});
upsert INTO tn (KEY,VALUE) VALUES (“key2”, { “kind”:“trycomment”,“id”:“2”, “commentText”:“on 1”, “parentId”:“1”, “dt”:“2020-02-03 09:03:00Z”});
upsert INTO tn (KEY,VALUE) VALUES (“key3”, { “kind”:“trycomment”,“id”:“3”, “commentText”:“on 2”, “parentId”:“2”, “dt”:“2020-02-03 09:04:00Z”});
upsert INTO tn (KEY,VALUE) VALUES (“key4”, { “kind”:“trycomment”,“id”:“4”, “commentText”:“on 1”, “parentId”:“1”, “dt”:“2020-02-03 09:02:00Z”});
upsert INTO tn (KEY,VALUE) VALUES (“key5”, { “kind”:“trycomment”,“id”:“5”, “commentText”:“on root”, “parentId”:null, “dt”:“2020-02-03 09:02:00Z”});
upsert INTO tn (KEY,VALUE) VALUES (“key6”, { “kind”:“trycomment”,“id”:“6”, “commentText”:“on 5”, “parentId”:“5”, “dt”:“2020-02-03 09:02:00Z”});
Order should be
1 (off root)
-2 (comment off 1)
–3 (comment off 2)
-4 (comment off 2)

CREATE INDEX ix1 ON default(parentId, id) WHERE kind = "trycomment";

SELECT d.l.*, 
     (SELECT RAW t1 FROM d.r  AS t1 ORDER BY AS sub
     FROM default AS l 
     LEFT NEST default AS r ON  = r.parentId AND r.kind = "trycomment"
     WHERE l.kind = "trycomment" AND l.parentId IS NULL) AS d 
     ORDER BY;

Above query gives all off root documents and corresponding documents as ARRAY sub in the expected order. Array position can be used how much off.