Model for user-editable, multi-tabular data

I have been working on developing a way to store tabular data in mongodb and have not been able to come up with a solution. I am building a project-management system where projects can be edited by different users before being approved. I want each project to have a section where user’s can put their responses in a table like this:

The caveat is that I want users to be able to add columns and rows to each of these tables. I have tried modelling this functionality with a one-many-many relationship between projects, “question groups” (each question group representing each one of the 5 tables", and “questions” (each question being the column headers". The problem is when I want an “admin” user to be able to add/edit/remove the column headers for every single project. Is there a better way to do this?

Hi @Thomas_Crosbie-Walsh ,

What would be the problem to keep each row and its reaponse/additional information in its own document:

_id : doc1,
questions:[{ qId :1question : "What ....", Response: ... },
 qId : n question : "What ....", Response: ... }]

This is flexible model.


@Pavel_Duchovny Thank you for your suggestion, I have rebuilt my schema around this and it works well.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.