cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

GraphQL - how to filter on custom field

How can you filter a custom field?

Say i have a field in my type definition using @cypher directive:

type Ticket {
id: String
title: String
date: DateTime @cypher(statement: "RETURN datetime(this.timestamp)")
}

Querying this is fine, however, if I try to filter it:

tickets (where: {date_GT: $from_date}) {
title
date
}

I get "date_GT" is not defined by type "TicketWhere"

1 REPLY 1

William_Lyon
Graph Fellow

Cypher directive fields are not added to the generated where filter argument because the field values would need to be computed for each node in the database at query time which would be prohibitively expensive in most cases. You could potentially add a query field using the Cypher directive that has the filtering logic defined in Cypher to accomplish this.