thingdom/node-neo4j

Library cannot handle Labels passed as parameter to query

mohummedalee opened this issue · 1 comments

While queries like

db.cypher({
        query: "MATCH (n:User) WHERE n._id = {given} RETURN n",
        params: {given: 'xxx'}
    },
    callback
};

work completely fine, queries of the form:

db.cypher({
        query: "MATCH (n:{type}) WHERE n._id = {given} RETURN n",
        params: {given: 'xxx', type: 'User'}
    },
    callback
};

where the label is passed as a parameter, report a syntax error. This is a basic functionality and should exist.

This is a limitation (by design) of Cypher the language, not this library.

Parameters can not be used as for property names, relationship types and labels, since these patterns are part of the query structure that is compiled into a query plan.

http://neo4j.com/docs/stable/cypher-parameters.html

In general, this library does not do anything with your query or parameters, so any errors you get back relating to your query are coming from Neo4j, not this library.

Hope this helps!