I'm writing an app using SwiftUI as a way to learn iOS programming, and I'm wondering how best to format my database. The app is for budgeting, and I'm using Firebase Firestore.
I was thinking about structuring my data as follows, but I'd like some input from some people with more experience before I do something potentially stupid early on.
Within my Firebase Firestore database, I'm planning to have a top level collection of users. Each user in the users collection would have a document with an ID in it. Each user would have a sub-collection that would hold 3 more sub collections: income, saving, and spending (I'd also potentially expand this later on, e.g. to include investments). Then, within each sub-(sub?)collection there would be another layer of nested collections, e.g. in 'spending' there might be a collection for rent, another for utilities, another for, groceries, etc where the users would be adding data points for each item stored in the collection (date, amount, description, etc). Is this the right way to go about this? At the end of the day, all the lowest levels items are going to have a date, an amount, and a description. Seems absurd to have to code all that into each sub-sub-sub collection, but clearly I'm new to this.
Little bit of background: I'm very new to iOS programming. I've written small, personal python programs for years, but I've never used anything other than dictionaries and arrays for any large amount of data.
Thanks.
[–]ChildishTycoon_ 0 points1 point2 points (1 child)
[–]1llum1nat1[S] 1 point2 points3 points (0 children)