Closed git-blame closed 2 years ago
Answering my own questions. Yes, nested filtering can result in empty nodes. If you want to remove non-matching results completely you will have to:
connectionFilterRelations
. If you are using cli commands, then creating a .postgraphilerc.js is the best way. To enable this exact option see #102 For my own example, it would be something like:
query pdf {
allFiles(first: 50, filter:
and: [
{type: {equalTo: "document"},
{latestFileScanByFileid: {
some: {
resultsuri: { endsWith: "pdf" }
}
}},
]
}) {
totalCount
nodes {
rowId
latestFileScanByFileid {
nodes {
resultsuri
}
}
}
}
}
We wrote views, functions, etc. in postgresql to represent relations/joins for postgraphile. But now we are exploring whether it is simply more robust/efficient to express them in graphql. I'm looking at the nested example and it seems to do the job. But when I try with something for example:
Instead of just getting results that match the filters on the 2 tables, namely "document" files that have "pdf" extensions. I do get those. But I get also empty results for:
For example:
My question is:
connectionFilterRelations
and for example use Exists, etc.?