Skip to content

Firestore Query Collection throws error if OR filter condition value on "array contains any" is empty list #3894

@leonardstiller

Description

@leonardstiller

Can we access your project?

  • I give permission for members of the FlutterFlow team to access and test my project for the sole purpose of investigating this issue.

Current Behavior

I want to query a list of documents (called "activities") from Firestore. I have two conditions I filter this list with:

  • "createdBy" field (type user reference) equals authenticated user reference

  • "sharedGroups" field (list of "groups" document references) contains at least one groups document where the authenticated user reference is a group member (members field is a list of user references of the groups document)

So the relevant document structure is:

users:

reference

activities:

sharedGroups (List<DocRef(groups)>)

createdBy (DocRef(users))

groups:

members (List<DocRef(users)>)

I was able to filter for the 1. condition. I was also able to filter for the second condition by creating a separate query in a container above where I query all groups documents where the members field contains the authenticated user reference and then using the result of that query to filter the sharedGroups field for that list with "groups Documents -> Reference mapping. I was also able to combine both filters with an OR statement which should produce the result of what I am trying to achieve. But if there are NO groups documents as a result of the seperated above query, I get an error (see screenshot). If there is a groups document returned everything works as intended..

Expected Behavior

I would expect the query working even if an empty list is used. Also using the "filter on null values" should have an effect here imo which it doesn't as far as I can tell.
So I am missing the option to catch an "empty list returned" case here since Firestore seems to be unable to handle that on Firebase side.

Steps to Reproduce

  1. Create "Query Collection" to Firestore with two filters connected via OR
  2. Make one of the filter conditions check for "array contains any" on an empty list

Reproducible from Blank

  • The steps to reproduce above start from a blank project.

Bug Report Code (Required)

ITFfz8r13ItOseFK0L6IYcBWoGEsC1scTeUzlO1hdwwbI+P1PIYuOfSkYldVcuqHdAhifVqjnnIHwNbXhs7tN+0EPU+CQYhqz6ttUxDgfGq7V6qIEru8R3FPO/JMG37A4LaJrhF+ANNpV0Y1w2Chf+uub3qCf9qOYwx5e6fDbOY=

Visual documentation

sldLRnyJvc4PoLyjJVHqa

Environment

- FlutterFlow version: Web
- Platform: iOS, Android, Online Emulator
- Browser name and version: -
- Operating system and version affected: -

Additional Information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions