Skip to content
This repository has been archived by the owner on Sep 3, 2021. It is now read-only.

Feature request: Filters for list properties #350

Open
wheresrhys opened this issue Nov 16, 2019 · 5 comments
Open

Feature request: Filters for list properties #350

wheresrhys opened this issue Nov 16, 2019 · 5 comments

Comments

@wheresrhys
Copy link

If I have a property, myProp, which is a list of strings or enums, I would like to be able to use a myProp_contains filter.

It looks like the lack of filters is by design https://github.com/neo4j-graphql/neo4j-graphql-js/blob/master/src/augment/input-values.js#L69, and most filters wouldn't make sense for lists, but contains querying feels like a very valid use case, and would map well to using IN in the underlying cypher.

I'm happy to submit a PR if you're in favour of the feature

@benjamin-rood
Copy link

benjamin-rood commented Nov 20, 2019

If I have a property (...) which is a list

I'm assuming you mean a property on a node in your Neo4j graph, but w.r.t. graphql strictly, just to clarify:

You mean a field in a type in your schema, yes?

@wheresrhys
Copy link
Author

wheresrhys commented Nov 20, 2019

Yes. To be absolutely precise the type would be something like

type MyThing {
     myProp: [String]
}

And I want to be able to query with

{
    MyThing(filter: {
         myProp_contains: "some string"
    }) {
       // some properties
   }
}

Which would run something akin to this in cypher:

MATCH (node:MyThing)
WHERE  "some string" IN node.myProp
...

@mobsean
Copy link

mobsean commented Oct 14, 2020

Issue should be closed, because PR #513

@mobsean
Copy link

mobsean commented Oct 15, 2020

Not sure to open a new Issue but:
As is said yesterday. The filter for list properties is working.

When you chain filters with AND or OR the filter isn´t working anymore.

For example:
typeDef:
type MyThing { myProp: [String] myOtherProp: String }

Totally fine:
query test { MyThing(filter: { myProp: ["abc"] }) { myProp myOtherProp } }

Not working: --> empty result. (I´m sure, there should be results)
query test2 { MyThing(filter: { AND: [ { myProp: ["abc"] }, { myOtherProp: "def" } ] }) { myProp myOtherProp } }

@michaeldgraham
Copy link
Collaborator

#608

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants