From 8f6e3bbeb1ba8ee96c5b284272305ba7c1f9a078 Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Fri, 17 Apr 2026 23:16:00 +0000 Subject: [PATCH] docs(graphile-postgis): lead with ORM `where:` shape for spatial relation examples --- graphile/graphile-postgis/README.md | 33 ++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/graphile/graphile-postgis/README.md b/graphile/graphile-postgis/README.md index db24063737..73b045d41e 100644 --- a/graphile/graphile-postgis/README.md +++ b/graphile/graphile-postgis/README.md @@ -81,23 +81,50 @@ COMMENT ON COLUMN . IS ### Filter shapes -2-arg operators use the familiar `some` / `every` / `none` shape: +2-arg operators use the familiar `some` / `every` / `none` shape. + +Through the generated ORM (`where:`): + +```ts +await orm.telemedicineClinic + .findMany({ + select: { id: true, name: true }, + where: { county: { some: { name: { equalTo: 'California County' } } } }, + }) + .execute(); +``` + +Or equivalently at the GraphQL layer (`filter:`): ```graphql telemedicineClinics( - filter: { county: { some: { name: { eq: "California County" } } } } + filter: { county: { some: { name: { equalTo: "California County" } } } } ) { nodes { id name } } ``` `st_dwithin` takes its distance at the relation level (it parametrises the join, not the joined row): +```ts +await orm.telemedicineClinic + .findMany({ + select: { id: true, name: true }, + where: { + nearbyClinic: { + distance: 5000, + some: { specialty: { equalTo: 'pediatrics' } }, + }, + }, + }) + .execute(); +``` + ```graphql telemedicineClinics( filter: { nearbyClinic: { distance: 5000 - some: { specialty: { eq: "pediatrics" } } + some: { specialty: { equalTo: "pediatrics" } } } } ) { nodes { id name } }