User 99x
User 99x

Reputation: 1021

Dynamic question answer tree structure in mongodb

I'm looking to build a question answer survey system where some questions will be based on the answer of the parent question. The hierarchy level of the questions can go any number of depth based on the questions. The questions and answers will be like the diagram shown here.

Question answer tree model

I'm looking to build this in mongodb and nodejs. I have checked the tree model in mongodb and I'm clueless on how to structure it as the next set of questions are depends on the answers. The questions should show based on what answer the user have selected and some answers may have multiple question sets below that as well (E.g.: Ans B).

Can someone help me on the mongodb collection structure and how can I query the next set of questions and answers based on the previous answer given by the user? Any guidance is appreciated. Thanks

Upvotes: 4

Views: 267

Answers (0)

Related Questions