I have a Class called Routine, it has the attributes name and exercises. Exercises in an ArrayList of type RoutineExercises.
When I write my Routine to my Firestore Database, it works like it should and adds a document with name and an array for the exercises with all the Objects inside my ArrayList.
However I think its propably not a good idea to store the exercises in the same document as the name, because I sometimes don't need these Exercises. So I wanted to create another Collection "RoutineExercises" inside my Routine Document which contains the ArrayList of RoutineExercises. This is what my Code looks like:
fm.getColRefUserRoutines().add(routine).addOnSuccessListener(new OnSuccessListener<DocumentReference>() {
@Override
public void onSuccess(DocumentReference documentReference) {
documentReference.collection("RoutineExercises").add(routine.getExcersises()).addOnSuccessListener(new OnSuccessListener<DocumentReference>() {
@Override
public void onSuccess(DocumentReference documentReference) {
Log.d("Success", "!!");
}
});
}
});
while fm.getColRefUserRoutine()
return my Collection of Routines.
But I the Exception:
java.lang.IllegalArgumentException: Invalid data. Data must be a Map or a suitable POJO object