1

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:

  1. I want to create a project(s). A project can consist of some meta data like name, url etc.
  2. I want to create a customer(s) and I want to be able to assign a customer to a project(s).
  3. 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.
  4. 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?

Community
  • 1
  • 1
the_disco
  • 112
  • 9

1 Answers1

0

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.

Community
  • 1
  • 1
Mark Hillick
  • 6,853
  • 1
  • 19
  • 23
  • Thanks for your answer. I guess I didn't formulate my question correctly. I wanted to know, if my design suits the scenario I described. I just want to avoid the pitfalls that can have impact on my application later in the development process. – the_disco May 30 '12 at 07:29