FTF Studio
FTF Studio

Reputation: 99

How to search array of keywords inside of a collection in firebase

I know how to search a single keyword inside of a collection in firebase flutterl. ButI want to know how to search an array of the keyword inside of collection in firebase using flutter???

please help me...

Upvotes: 0

Views: 178

Answers (1)

Maikzen
Maikzen

Reputation: 1624

I found this function:

var ref = _firestore
           .collection("collection1")
           .where("att", arrayContains: array);

This will return all the documents in collection1 collection where the array att contain either of the items in the array you pass. Then you can filter through that array and check which documents' att array contains all those items.

Upvotes: 1

Related Questions