Reputation: 2518
I'm playing around with Directus and wanted to filter my items by counting O2M relations.
I tried using has
, but as described in docs it counts "at least n items", but I want to retrieve all items with a relation count of 0
. How can I achieve this?
Having two tables:
My current request is like this:
https://directus.localhost/_/items/products?meta=total_count,result_count&limit=100&offset=0&fields=id,suppliers.*&filter[suppliers][has]=0
But I get all products, since all do have at least 0 suppliers. How to filter exactly zero suppliers?
Thanks for any advice!
Upvotes: 3
Views: 1680
Reputation: 652
Well I am not sure about the structure of your data. But I had the problem in the past that I wanted to filter for all files which has no link to a folder. What at the end worked for me was something like this:
&filter[suppliers][_null]=true
Upvotes: 1