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.
Have designed the following schema -
I am planning to make it fast.. so for every question i want to skip the db roundtrip for fast loading.. I have following concerns -
Can i put all questions in some javascript variable and access them from there? But i am afraid it will also contain the answers..like user might see them by using firebug etc.. Shall i send only questions list(without answers) in frontend, and upon answering do a ajax call to check the answer if it is correct or not?
The other doubt is about categories - is the above schema is good?
or shall i create a new collection for categories and put all question ids related to that category.
Please share your views.