I am making a multiple choice question bank where users can create tests from a much larger set of questions (e.g., create a test of 50 questions out of 500 lets say). My question is what is the best way to store this information? I would like to be able to search used, unused, correct, incorrect etc. efficiently. Using SQL is "simpler" where I have a test table storing each answer (along with answer selected, correct/incorrect etc). In SQL, I had almost everything stored as a number (e.g., question_id, answer_id selected which related to a question table, answer table) but in mongo I feel as if I am storing everything as a string and this would slow it down significantly. Should I try and mimic what I did in SQL? How should I store multiple answer choices (which can vary in number) as well as the number of times that answer choice has been selected? This is what I am thinking of:
var SubjectsSchema = new Schema ({
subject: { type: String }
});
var TopicsSchema = new Schema ({
topics: { type: String }
});
var QuestionSchema = new Schema ({
author: { type: String },
title: { type: String },
subject: { type: Number },
topic: { type: Number },
question: { type: String },
answers: { },
explanation: { type: String }
});
var TestSchema = new Schema ({
user: { type: String },
test_number: { type: Number },
completed: { type: Boolean },
date: { },
subjects: { },
topics: { },
noq: { type: Number }, // number of questions
questions: { }
});