Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-30-2019 01:45 AM
Hi,
im a fairly inexperienced coder so this question might be obvious to u guys.
Currently trying to set up the schema with makeAugmentedSchema, but I want to create the resolver functions and queries myself (both for a later purpose in the app but also just for practice and learning).
So the Q: Why does 1 work but not 2?
1.
openTrades(isOpen: Boolean): [Trade]
@cypher(
statement: "MATCH (t:Trade) WHERE t.isOpen = $isOpen RETURN t"
)
2.
openTrades: [Trade]
@cypher(
statement: "MATCH (t:Trade {isOpen: true}) RETURN t"
)
01-30-2019 08:37 AM
Both look correct to me. Are they both fields on the Query type? Are you getting an error with the second option?
01-30-2019 08:55 AM
Yes they are both fields on the QueryType.
This is the error msg:
"message": "Invalid input ',': expected whitespace, comment or an expression (line 1, column 76 (offset: 75))\n"WITH apoc.cypher.runFirstColumn("MATCH (t:Trade {isOpen: true}) RETURN t", , True) AS x UNWIND x AS trade
"\n
01-30-2019 11:22 AM
Ah - I believe that is related to this issue, which has been fixed in master and will be available in the next release.
The problem is that if a parameter is not specified then we don't insert a blank object resulting in a syntax error in the generated Cypher statement. The fix should be released in the next few days, but in the mean time you can avoid this error by ensuring a parameter is used, for example this should work:
openTrades(ignoreMe: String = ""): [Trade]
@cypher(
statement: "MATCH (t:Trade {isOpen: true}) RETURN t"
)
All the sessions of the conference are now available online