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
谢谢