Understand Databases

If someone could explain something to me I would be very appreciative. If I were to create my own database, would that mean collecting data, hosting it on say Firebase in JSON format, and then communicating with that JSON data from my iOS app? I having a database simple as having a JSON file to communicate with? Last part of this question is, if I allowed a users to read and write data to a database, would I then need to manually update the JSON file?

Yes, for creating a cloud database. Except if you’re hosting it on Firebase using Firestore or the Real-time Database, you’d use Firebase APIs to communicate with it

I wouldn’t call it a “database” exactly, but saving data to just a JSON file in your app would be a method of “persisting data.” It’s not technically a database
But yeah the general idea is a way to save data in your app between “sessions” when the user opens / closes the app.

Yes, you would need to re-save the data each time a user changed something

—-

A few questions for you, are you wanting a cloud database, or a local storage solution / database?

The data you’re talking about, do you want only one user to update data on their own (no one else has access to it) or do you want multiple people to be able to update the same data?

1 Like

Mikaela, thank you for your response!

To answer your question, I have build an app which communicates with the Spoonacular API in order to track calorie and macro-nutrient data associated with food the user logs in the app.

I have been building my own food-nutrient dataset and I’m confused as to how I should go about storing existing data, then allowing users to read the data as well as add new data.

After doing some research I think my best option is to use Firebase Realtime Database? Or maybe Firebase Firestore is better?

Thanks again for your response!

Existing data in what way? Like from the API?

And like you’re wanting to make a big database where all users can contribute different foods? I don’t understand how you want it to work?

Yes either of these work. I’d suggest Firestore because it’s newer, has some better features, and faster queries, and scales better

Here’s a comparison doc if you can’t decide