#community-help

Filtering by a Field in an Array

TLDR Andrew asked how to filter by a field in an array. Jason provided the solution animals:[cat] and a documentation link.

Powered by Struct AI
4
7mo
Solved
Join the chat
Feb 19, 2023 (7 months ago)
Andrew
Photo of md5-7766f890de99fa72a6d81315691a6758
Andrew
05:02 PM
Can i filter by a field being in an array? For instance,

String animal = ‘cat’;
List<dynamic> animals = [dog, cat, fish,]
Filter by: animals:contains[cat]

Just pseudo code but i hope the point makes sense
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
05:05 PM
Yup. You want to do animals:[cat]
05:05
05:05
Jason
05:05 PM
Search for “Filtering Arrays”