Firestore search array contains for multiple values Android

469 Views Asked by At

I am using Cloud Firestore and within collections,one named "channels" containing the following values -> enter image description here

users : ["_id1","_id2"]

I have to search in a way to check both the values from users array. I am trying this way but its giving me nothing

db.collections("channels").WhereArrayContains("users", listOf("_id1","_id2")).get()

But the search is not getting the results. Because it seems the query is incorrect. What is the solution for it? please mention the query for it.

Note - WhereField is deprecated in android so I can't use it anymore.

1

There are 1 best solutions below

2
On

Try db.collection("channels").WhereArrayContains("users", listOf("_id1","_id2")).get() - you referenced the db collection in plural and missed the closing quote in the collection name which might be the reason why it didn't work.