I am checking whether the Boolean field called attending
exists, however I am not sure how to do that.
Is there a function such as .child().exists()<
What you're doing now is correct - you have to read the document and examine the snapshot to see if the field exists. There is no shorter way to do this.
You can do the following:
if(task.isSuccessful()){
for(QueryDocumentSnapshot document: task.getResult()){
if (document.exists()) {
if(document.getBoolean("attending") != null){
Log.d(TAG, "attending field exists");
}
}
}
}
From the docs:
public boolean exists ()
Returns true if the document existed in this snapshot.