According to the official documentation regarding query operators:
You can use the array-contains operator to filter based on array values.
As I can see in your code, your friendIds
argument that is passed as the third parameter to the where()
function is of type array
. What you are actually doing, you are searching in the members
property which is of type array for an array, which is actually not possible since I assume the members
array in your database contains numbers.
An query like this:
Firestone.collection('conversations')
.where('members', 'array-contains', 3)
.get()
.then(querySnapshot => console.log(querySnapshot))
.catch(error => console.log(error));
Will work perfectly fine because we are searching within the members
array for a number.
If you need to query for all those numbers, you should perform three separate queries and combine the result client side.