In my android app I built an object named "Lesson" (which has only 2 fields of strings).
I have a collection on Firestore that one of its fields is an array of "Lessons"(which called "my lessons").
I want to add another lesson to the array. I tried using :
DocumentReference.update("myLessons", FieldValue.arrayUnion(A_LESSON));
but I always get an exception:
java.lang.IllegalArgumentException: Invalid data. Unsupported type: com.example.classmate.Models.Lesson
But when I tried to do it with integers and strings it worked (despite the fact that I declared the array as a "Lesson" array).
Is it possible to upload to an array a non-preemptive object? how can I upload an object to an array?
Thanks!