0

I'd want to write something like that:

public Query getQueryToNotDeletedUsers(String user_id) {
    return FirebaseFirestore.getInstance().collection("users").whereEqualTo("deleted", false).whereEqualTo("ID", user_id);
}

As you can see, I can't just write something like .document(the_id) since I use a Query object (the where call).

I've already seen some answers to this question, but not in Java. Indeed:

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
JarsOfJam-Scheduler
  • 2,809
  • 3
  • 31
  • 70

1 Answers1

1

On Android that would be FieldPath.documentId():

FirebaseFirestore.getInstance().collection("users").whereEqualTo(FieldPath.documentId(), user_id).whereEqualTo("deleted", false)

See the Firebase reference documentation. I highly recommend keeping the (reference) documentation handy, as this is a quite literal translation of the JavaScript code in the questions you linked.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807