I'm trying to accomplish this scenario :

There are 2 types of users, let's say Admin and Worker, and there have different roles.

Admin can do a CRUD of questions, and also can create a room where the users can join to play together (this is just a name) but maybe is a good idea to create more attributes inside of it like, WHO is playing in this room, POINTS for everyone but let's talk it afterwards when I show you the design.

Worker can play solo or multiplayer.

Ok the thing is, on my design I have :

Collection named User which contains :

  1. _id
  2. username
  3. password

This is a default one, but then I'm wondering how do I define the Role if it's an Admin or a Worker, something like isAdmin:true and then I check this Bool? Also I'd like to have the reference for those questions where the user has failed more, I mean like a wrongQuestionNumber which contains the _id of the question and the times he/she failed

Then I'd like to have the Question collection where contains :

  1. _id
  2. question_name
  3. answers[1,2,3,4]
  4. correctAnswer or answers because it can be multi option chooser
  5. topic
  6. isExamQuestion

Then the Room collection should contains :

  1. _id
  2. name
  3. capacity
  4. type (game can be as a group or solo) that's why this attribute
  5. exam (this is an object created by Admin means that when he creates a question he can select many and create an exam with those)
  6. ranking (This is the top X from 1 to X)
  7. don't think if I have to add the winner here because if I get the position 0 from ranking I get the winner...

There's a collection named Topic as well, if my question have a topic then I can select the question by Topic. An example of Topic should me Math so user can do only exams or do tests with math questions.

  1. _id
  2. Name
  3. Questions[...]

Then I have to store like a historic about what are the questions worker has answered correct and what did not, to make some statistics, but I need to store some historicals for Admin to see in this topic the average that Workers have failed more is : Question23 (for instance) something like that.

Any tip is welcome, and improvement as well.


@uokesita recommend to me to use PostgreSQL so maybe it's a good idea doing this way, how could be the schema?


Your question is not clear. You are making many general questions, which makes any answer very difficult. I propose to atack the problem in small pieces, and solve each.

A few remarks that came to my mind:

  • Why it's not clear, is about creating the design of this database, and yes, maybe mongo is not the best option, then what should I use instead? – Skizo-ozᴉʞS Jan 14 at 11:25
  • 1
    you ask many questions. For a good answer, you should ask one question in a clear form. Take a look at mariaDB, an open source sql database. They seem to have good documentation. Or just the SQL database that best integrates with whatever platform/language you are using. Don't overt think it. – cauchy Jan 14 at 11:36
  • Yes, but I mean it's just to how to design the database and if it's a good idea use mongodb or not – Skizo-ozᴉʞS Jan 14 at 11:41

ozᴉʞS, I agree with the others that MongoDB is "not good" for this scenario. Not good meaning there is a better way to approach this, with MongoDB you will be complicating yourself and your work; I think you should use a traditional SQL database (MySQL, Postgres, SQLite, MariaDB, etc.)

I suggest you start with an entity-relationship diagram to define your data



And then I suggest trying Postgres

protected by gnat Jan 15 at 9:29

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.