I've created an android app with Java and I use a Firebase realtime-database. Via REST, I get JSON-data for cities. "Data" means:
- base data like the city-id, name or population. They rarely change. This is represented in my model class "BaseData".
- (movement) data which changes every day. The class is called "CityData".
BaseData is currently part of the CityData:
public class CityData
{
private BaseData baseData;
private int cases;
//...
}
At this time, I can only request data for today. When I save a CityData-object in my db, it looks like this:
My next step: Save the data for the last 7 days. But: Firebase would also save the base data every day. Can I prevent this (=> only save when not exists or update when something changes)? Otherwise, I have to change the data struct. But which is the best possibility? My first idea: Create two seperate paths like this:
But then, I have to extract BaseData from CityData and join them every time, for example when I need the city name, which is often. Is this the best way? It's my first time with NoSql, so every help would be nice!