Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MongoDB quiz application schema

 
kuldeep sidhu
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am planning to make sample quiz application using monogdb,Java using spring-data mongodb framework.
The application will be very simple. First page will display list of categories. like Sports,Politics.
When user will click on any category some random questions will be fetched from that category.
On a page one question will be displayed having four options. One or more than one of those can be correct answers.
I have designed the following basic schema for questions -



Is there any better way to do this ? or shall i put category for each question ?

is the above schema is good?
or shall i create a new collection for categories and put all question ids related to that category.

 
amit punekar
Ranch Hand
Posts: 544
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
From whatever I know about MongoDB, best schema is the one that helps you to retrieve data faster.
Hence for example if you are showing category and questions in one page then denormalized schema is good.
However there is a limit of 16MB per MongoDB Document that you should keep in mind.
Here is another reference to determine the best possible way - Mongo DB Schema design

Regards,
Amit
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic