This answer touches on how to merge two queries together and I suppose this could be done for any number of known queries. However, I have an array of values I want to use to filter for documents that contain a field with those values(It is the same field for all values). The method linked above does not seem sufficient for this purpose.
I tried creating an array of queries using the new operator but this does not work since Query
is private.
Query query = db.collection("posts")
.whereEqualTo("userId", followingList)//followingList is a list of Strings that I want to query
.orderBy("imageUrl_1", Query.Direction.ASCENDING);
This does not work since followingList
is not a String
How I tried to create an array of Queries that does not work:
ArrayList<Query> list = new ArrayList<Query>();
for(String s : followingList){
list.add(new Query());//does not compile
}
This image of my Firestore shows how
followingList
is created. It is updated when a user clicks follow on the post of another user. What I want to be able to do is to create a query of all posts(contained in a separate collection) that contain the userIs's contained in followingList