Querying deeply nested self-referencing collections

System Information
  • Strapi Version:
  • Operating System:
  • Database:
  • Node Version:
  • NPM Version:
  • Yarn Version:

Dear all,

I currently have a collection called Topic, which is a self-referencing collection with parentTopic referenceing another topic in collection. This collection can have up 6 deep levels of self-referencing. I am currently trying to achieve the following

  1. User queries a topic
  2. I need to be able to reconstruct all parents and children of that topic
  3. e.g.
[{id: 1, topicName: "Topic 1", parentTopic: {id: 2, name: "Topic 2", parentTopic: {id: 3, name: "Topic 3"}}]

Currently when I use strapi entity service, and pass a context query with filters it will only filter out the first nested level. I know that I could pass a deeply nested context query filters to ask strapi to give me those levels, but I was wondering if there’s an easier way

I would appreciate if anyone would help :slight_smile: