diff --git a/docs/usage/reading/filtering.md b/docs/usage/reading/filtering.md index 1d98bee35d..dab1fdb6e2 100644 --- a/docs/usage/reading/filtering.md +++ b/docs/usage/reading/filtering.md @@ -42,7 +42,7 @@ GET /users?filter=equals(displayName,null) HTTP/1.1 GET /users?filter=equals(displayName,lastName) HTTP/1.1 ``` -Comparison operators can be combined with the `count` function, which acts on HasMany relationships: +Comparison operators can be combined with the `count` function, which acts on to-many relationships: ```http GET /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 ``` Aside from filtering on the resource being requested (which would be blogs in /blogs and articles in /blogs/1/articles), -filtering on included collections can be done using bracket notation: +filtering on to-many relationships can be done using bracket notation: ```http -GET /articles?include=author,tags&filter=equals(author.lastName,'Smith')&filter[tags]=contains(label,'tech','design') HTTP/1.1 +GET /articles?include=author,tags&filter=equals(author.lastName,'Smith')&filter[tags]=any(label,'tech','design') HTTP/1.1 ``` In 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. +Note this does **not** hide articles without any matching tags! Use the `has` function with a filter condition (see below) to accomplish that. + Putting it all together, you can build quite complex filters, such as: ```http @@ -112,7 +114,7 @@ Examples can be found in the table below. Filters can be combined and will be applied using an OR operator. This used to be AND in versions prior to v4.0. -Attributes to filter on can optionally be prefixed with a HasOne relationship, for example: +Attributes to filter on can optionally be prefixed with to-one relationships, for example: ```http GET /api/articles?include=author&filter[caption]=like:marketing&filter[author.lastName]=Smith HTTP/1.1