I'm trying to fetch multiple documents but I'm unable to do it. I wanted to fetch multiple documents containing my search criteria.
Here's what I tried.
final FirebaseFirestore db = FirebaseFirestore.instance;
QuerySnapshot<Map<String, dynamic>> querySnapshot = await db
.collection('MyCollection')
.where('FldName', 'in', ['123', '345', '111']).get();
Error on the syntax which is pointing in the 'in'
:
Too many positional arguments: 1 expected, but 3 found.
Here's what my firebase looks like.
CodePudding user response:
You need to use whereIn
like this:
.where('FldName', whereIn, ['123', '345', '111']).get();
Not, in
as a String
.
CodePudding user response:
The where query might be incorrect, try using this one that I got from the docs.
.where('FldName', arrayContainsAny: ['123', '345', '111'])
CodePudding user response:
I guess you will find solution here https://rb.gy/umw0lr