Reputation: 1400
I have a Firestore collection I am querying and referencing another document that I have already queried prior (teamRecord
). In this case everything is working up to the final 'user_inchallenge' call. In this case, the user_inchallenge
is a DocumentReference and the teamRecord.usersInTeam
is a List of DocumentReferences. However, there whereIn
call does not seem to be working properly. I only want to return docs where user_inchallenge
is held within teamRecord.usersInTeam
.
FirebaseFirestore
.instance
.collection('activity_units')
.orderBy('activity_value', descending: true)
.where('challenge_reference', isEqualTo: challenges.reference)
//below is not working
.where('user_inchallenge', whereIn: teamRecord.usersInTeam.asList())
As a note, if I remove the .asList()
call in usersInTeam
I get the error:
The argument type 'BuiltList<DocumentReference>' can't be assigned to the parameter type 'List'.
I also tried isEqualTo
, arrayContains
, but none of them have returns the filtered results.
Upvotes: 1
Views: 592
Reputation: 598728
The whereIn
parameter expects a List
, and it seems that BuiltList
is not actually a List
.
You'll want to convert your BuiltList
to a List
(e.g. by calling asList()
or toList()
on it) and then pass that to the Firestore call.
I filed issue #10407 on the GitHub repo to see if the types can be change to be Iterable
.
Upvotes: 0