@@ -42,7 +42,7 @@ GET /users?filter=equals(displayName,null) HTTP/1.1
42
42
GET /users?filter=equals(displayName,lastName) HTTP/1.1
43
43
```
44
44
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:
46
46
47
47
``` http
48
48
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
60
60
```
61
61
62
62
Aside 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:
64
64
65
65
``` 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
67
67
```
68
68
69
69
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.
70
70
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
+
71
73
Putting it all together, you can build quite complex filters, such as:
72
74
73
75
``` http
@@ -112,7 +114,7 @@ Examples can be found in the table below.
112
114
113
115
Filters can be combined and will be applied using an OR operator. This used to be AND in versions prior to v4.0.
114
116
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:
116
118
117
119
``` http
118
120
GET /api/articles?include=author&filter[caption]=like:marketing&filter[author.lastName]=Smith HTTP/1.1
0 commit comments