0

I tested the following query in a Neo4j browser and it worked. Now I am trying to define a schema and query for a React app using the neo4j-graphql-js plugin/driver (import { neo4jgraphql } from "neo4j-graphql-js";). My issue is I do not know how to define a schema that will take 2 parameters, example: action(startTime: {epoch}, endTime: {epoch}). The action node in the DB has the following properties: action, timelist and timestamp.

MATCH (sec:Second)<-[:AT_TIME]-(act:action)-[:TARGET]->(obj:object)
WHERE act.timestamp >= 1499350389000 AND act.timestamp <= 1499350389000 
RETURN sec, act, obj
N6DYN
  • 325
  • 1
  • 3
  • 17
  • I'm I thinking about this problem the wrong way? I have spent all day looking for an example that includes passing date/time as parameters in a schema and still have not found any. All I've seen are types with different parameters, ex(ID and name) but none with (startTime, endTime). The problem I am running into is that I can only declare timestamp (a property of an object) once. So I can't do (timestamp, timestamp). Also, you cannot introduce new parameters in your schema. The only ones you can use are the ones in found in the Neo4j DB. Not sure what else to do. – N6DYN Aug 15 '18 at 02:02
  • Also found out I cannot define a type that is not an object in my DB. Like: Type interval. Because interval is not an object in my DB. – N6DYN Aug 15 '18 at 02:46
  • So my DB does not know what is startTime/endTime it only knows timestamp which is a property of the action object, which is what I am after. So I need someway to define startTime/endTime that Neo4j will understand... – N6DYN Aug 15 '18 at 02:48
  • This is what I am trying to the do. Found in 'Parameterizing Fields with Arguments' section. Ref: https://www.howtographql.com/advanced/2-more-graphql-concepts/ – N6DYN Aug 15 '18 at 03:32

0 Answers0