@@ -42,7 +42,7 @@ GET /users?filter=equals(displayName,null) HTTP/1.1
4242GET /users?filter=equals(displayName,lastName) HTTP/1.1
4343```
4444
45- Comparison operators can be combined with the ` count ` function, which acts on HasMany relationships:
45+ Comparison operators can be combined with the ` count ` function, which acts on to-many relationships:
4646
4747``` http
4848GET /blogs?filter=lessThan(count(owner.articles),'10') HTTP/1.1
@@ -60,14 +60,16 @@ GET /customers?filter=has(orders)&filter=equals(lastName,'Smith') HTTP/1.1
6060```
6161
6262Aside from filtering on the resource being requested (which would be blogs in /blogs and articles in /blogs/1/articles),
63- filtering on included collections can be done using bracket notation:
63+ filtering on to-many relationships can be done using bracket notation:
6464
6565``` http
66- GET /articles?include=author,tags&filter=equals(author.lastName,'Smith')&filter[tags]=contains (label,'tech','design') HTTP/1.1
66+ GET /articles?include=author,tags&filter=equals(author.lastName,'Smith')&filter[tags]=any (label,'tech','design') HTTP/1.1
6767```
6868
6969In the above request, the first filter is applied on the collection of articles, while the second one is applied on the nested collection of tags.
7070
71+ Note this does ** not** hide articles without any matching tags! Use the ` has ` function with a filter condition (see below) to accomplish that.
72+
7173Putting it all together, you can build quite complex filters, such as:
7274
7375``` http
@@ -112,7 +114,7 @@ Examples can be found in the table below.
112114
113115Filters can be combined and will be applied using an OR operator. This used to be AND in versions prior to v4.0.
114116
115- Attributes to filter on can optionally be prefixed with a HasOne relationship , for example:
117+ Attributes to filter on can optionally be prefixed with to-one relationships , for example:
116118
117119``` http
118120GET /api/articles?include=author&filter[caption]=like:marketing&filter[author.lastName]=Smith HTTP/1.1
0 commit comments