Setting up my first schema for a budget

So this is my first week working with MongoDB and I’ve come to a road block because I don’t know how I should set up my schema in Javascript, I have 3 Models: Budget, CategoryGroup, Category. I want one category to hold one budgeted amount for each month. But I don’t want to store the data directly in Category (I think)

so what I would is budget to store it something like this:

    CategoryGroup: {
        CategoryGroupID
        Categories: [
            { CategoryID, value},
           { CategoryID, value},
        ]
    }

So that I can get like “Monthly expenses” -> “Rent” + “400” f.ex.
Is this doable and how?

Is it over engineered? How would you guys with experience do it.
Remember that I already have CategoryGroups and Categories.

English is not my native tongue so it might not be exactly clear what I want to achieve but I hope you understand anyway. Thanks in advance.

I suggest that you go through the free MongoDB learning module on data modelling. MongoDB Courses and Trainings | MongoDB University

I have 30 years of RDBMS experience and I found it most instructive. I have changed my database as a result.

2 Likes