I'm trying to use Firestore.
I have a collection Group which contains a List of users
public class User {
private String mail;
private String username;
public User() {
}
public User(String mail, String username) {
this.mail = mail;
this.username = username;
}
public String getMail() {
return mail;
}
public String getUsername() {
return username;
}
}
I would like to update this list so I've tried :
List<User> list = new ArrayList<>();
list.add(new User("mail@gmail.com", "foo"));
reference.update("users", list)
.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Log.d(TAG, "DocumentSnapshot successfully updated!");
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.w(TAG, "Error updating document", e);
}
});
}
But I have an exception :
java.lang.IllegalArgumentException: Invalid data. Unsupported type: my.package.name.models.User
How can I update a list of object using Firestore ?