Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js Neo4j cypher查询返回的布尔值,不带大小写_Node.js_Neo4j_Cypher - Fatal编程技术网

Node.js Neo4j cypher查询返回的布尔值,不带大小写

Node.js Neo4j cypher查询返回的布尔值,不带大小写,node.js,neo4j,cypher,Node.js,Neo4j,Cypher,我知道你能做到 match (user:User {username:'${username}', password:'${password}'}) RETURN CASE WHEN user.blocked='true' THEN true ELSE false END as blocked, user.username as username, user.uid as uid 但我希望找到一种用

我知道你能做到

match (user:User {username:'${username}', password:'${password}'})
            RETURN
            CASE WHEN user.blocked='true' THEN true ELSE false END as blocked,
            user.username as username,
            user.uid as uid
但我希望找到一种用cypher返回布尔值的较短方法,我正在使用nodejs,在我的对象中的每一个布尔值道具上都有这样的例子,看起来非常冗长。。。有更好的办法吗?谢谢

您可以更换:

CASE WHEN user.blocked='true' THEN true ELSE false END AS blocked
为此:

user.blocked='true' AS blocked
现在,如果您在
blocked
属性中实际存储了一个布尔值(而不是字符串),则可以进一步简化上述内容:

user.blocked AS blocked

旁白:为了进一步提高性能,您可能应该使用而不是“${username}”和“${password}”。

这是我的错误,我传递的是字符串,而不是开始时的布尔值
match(user:user{uid:'${uid}})set user.blocked='${blocked}'返回user.uid作为uid,user.blocked作为blocked
谢谢