I am trying to write a query with AND operator to extract data from neo4j in GraphQL but it doesn't return any result. I am using neo4j-graphql-js library. I have the following schema
type Order {
label: String
id: String
details: [OrderDetails] @relation(name: "RELATED_TO", direction: "OUT")
}
type OrderDetails {
createdBy: String
label: String
oId: String
}
Following is the query:
{
Order(filter: { AND: [{ label: "fruits", details: {label: "banana"} }] }) {
label
}
}
I also tried this:
{
Order(filter: { label: "fruits", details: {label: "banana"} }) {
label
}
}
But these two queries do not return any result. If I just write label: "fruits" without AND it returns the result but I want all orders of fruit which are particularly for banana. Any suggestion where I am getting wrong?
Since you have mentioned about using neo4j-graphql-js library. You can do something like this:
{
Order(
filter: { label: "fruits", details_single: { label: "banana" } }
) {
details {
label
}
}
}