0
votes

How can I get all the values of all fields but from certain documents. I tried using addSnapshotListener but it only works with collections. For example I have the collection "App1" --> the document "user1" --> Sport: "Basketball" --> "user2" --> Sport: "Football" --> "user3" --> Sport: "Tennis"

How can I get the sports every user does? Thanks in advance.

1

1 Answers

1
votes

If you want to know all the possible values a field may have in a collection, you will have to query the entire collection, iterate all the documents, and collect all the values in your code. Firestore doesn't provide any aggregation operations to make this sort of query easy. You may want to consider storing your data differently in order to ease this sort of query.