You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+40-8Lines changed: 40 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -367,6 +367,24 @@ query {
367
367
}
368
368
```
369
369
370
+
A node passes the filter if a related node exists *and* the filter criteria for the related node are satisfied. (If a related node does not exist, the check fails.)
371
+
372
+
The `*Exists` Boolean field can be used to filter on the existence of a related node:
373
+
374
+
```graphql
375
+
query {
376
+
allPosts(filter: {
377
+
personByAuthorIdExists: true
378
+
}) {
379
+
nodes {
380
+
id
381
+
}
382
+
}
383
+
}
384
+
```
385
+
386
+
The `*Exists` Boolean field is only exposed on nullable relations. For example, if the `post.author_id` column is defined as `not null`, a related `person` always exists, so the `personByAuthorIdExists` field is not exposed.
387
+
370
388
</details>
371
389
372
390
<details>
@@ -378,13 +396,31 @@ query {
378
396
```graphql
379
397
query {
380
398
allPeople(filter: {
381
-
accountByPersonId: { status: { equalTo: ACTIVE } }
399
+
accountByAccountId: { status: { equalTo: ACTIVE } }
382
400
}) {
383
401
...
384
402
}
385
403
}
386
404
```
387
405
406
+
A node passes the filter if a related node exists *and* the filter criteria for the related node are satisfied. (If a related node does not exist, the check fails.)
407
+
408
+
The `*Exists` Boolean field can be used to filter on the existence of a related node:
409
+
410
+
```graphql
411
+
query {
412
+
allPeople(filter: {
413
+
accountByAccountId: true
414
+
}) {
415
+
nodes {
416
+
id
417
+
}
418
+
}
419
+
}
420
+
```
421
+
422
+
The `*Exists` Boolean field is only exposed on nullable relations. For example, if the `person.account_id` column is defined as `not null`, a related `account` always exists, so the `accountByAccountIdExists` field is not exposed.
423
+
388
424
</details>
389
425
390
426
<details>
@@ -406,32 +442,28 @@ query {
406
442
}) {
407
443
nodes {
408
444
id
409
-
createdAt
410
445
}
411
446
}
412
447
}
413
448
```
414
449
415
-
There is also an `exist` Boolean field for evaluating whether any related objects exist.
450
+
The `*Exist` Boolean field can be used to filter on the existence of related records:
416
451
417
452
```graphql
418
453
query {
419
454
allPeople(filter: {
420
-
postsByAuthorId: {
421
-
exist: true
422
-
}
455
+
postsByAuthorIdExist: true
423
456
}) {
424
457
nodes {
425
458
id
426
-
createdAt
427
459
}
428
460
}
429
461
}
430
462
```
431
463
432
464
</details>
433
465
434
-
For additional examples, see the [tests](https://github.com/graphile-contrib/postgraphile-plugin-connection-filter/blob/master/__tests__/fixtures/queries/filters.graphql).
466
+
For additional examples, see the [tests](https://github.com/graphile-contrib/postgraphile-plugin-connection-filter/blob/master/__tests__/fixtures/queries/).
0 commit comments