I’m trying to write a web based application for time tracking. I’m still researching the set of tools I want to use to build the application but I wanted it to be NoSQL database driven (MongoDB in my case). I have no experience using NoSQL databases at all, therefore my question. Lets assume following situation:
- I want to create a project(s). A project can consist
of some meta data like name, url etc. - I want to create a customer(s) and I want to be able to assign a
customer to a project(s). - Each project can have a various amount of steps to be accomplished
until it is done. Step belongs to a project. One step can consist of
more events because it might take more days to accomplish a step. - Based on the information from the steps I want to be able to
calculate the total time I have spend on a project and calculate a
total time I spent for each step (for invoices for example).
After researching a little bit about MongoDB my first approach would look more or less like that:
Customers collection
{
"_id": 4e91bcb40b7aab256c000000,
"name": "Example",
"address": "Some street"
}
Projects collection
{
"name": "My new Project",
"customers_id": 4e91bcb40b7aab256c000000,
"steps": [
{
"name": "Design",
"desctiption": "Frontend design",
"time_tracker": [
{
"description": "designed home page"
"start": 2012-05-28 10:10:10
"end": 2012-05-28 15:15:15
},
{
"description": "designed home page buttons"
"start": 2012-05-29 10:10:10
"end": 2012-05-29 15:15:15
}
]
}
]
}
Is it a good database design? Should I normalize the steps? Can I expect any problems along the way (like performance problems calculating totals for big project etc.)? Should I stick with RDBMS in this case?
Any tips from your experience?
It depends on your use case, your application and your data.
To avoid repetition this has been discussed previously quite extensively on Stackoverflow – When to use MongoDB or other document oriented database systems? and here When to use MongoDB.
Regarding the design that you’ve mentioned above, that looks fine to me.