android studio/firestore - how to add a new FIELD to existing document WITHOUT deleting old data
To update an existing document, call update
instead of set
.
for(QueryDocumentSnapshot doc: task.getResult()){
doc.getReference().update(userForOrgs);
}
Also see the Firebase documentation on updating an existing document.