Open KevinBrustolin opened 3 months ago
Hello,
I'm looking for a way to query a table where the length of the children (has_many relation) is greater than 0.
I'm currently doing it like this:
const disciplines = useLstObservable({ table: 'param_discipline', }); const [filteredDisciplines, setFilteredDiscipline] = useState([]); useEffect(() => { const getFilteredDisciplines = async () => { const filteredDisciplines = []; for (const discipline of disciplines) { const count = await discipline.epreuves.count; if (!!count) { filteredDisciplines(discipline); } } return filteredDisciplines; }; getFilteredDisciplines().then(setFilteredDiscipline); }, [disciplines]);
Is there a better way ?
https://watermelondb.dev/docs/Query#conditions-on-related-tables-join-queries
Hello,
I'm looking for a way to query a table where the length of the children (has_many relation) is greater than 0.
I'm currently doing it like this:
Is there a better way ?