来自nodejs的Neo4j多个密码查询

时间:2018-08-03 09:33:25

标签: javascript node.js neo4j cypher graph-databases

我想将所有这些查询运行到neo4j中,我可以在会话中成功运行一个密码查询,但是对于多个查询,它显示错误。 对于个别查询,我还需要将结果返回JSON格式。有什么帮助吗?

var array=[];
var ftrend= [ '21', '23', '24', '41', '42', '43' ]
console.log("Query for TSB");

for (var j = 0; j<ftrend.length; j++){
    var b=0; var m=0; var t=0;

    for (var i = 0 ; i < 16; i++) {

        t= t+1;
        tbm_id = 'T'+t;
        array.push('MATCH (qck:QuickCheckKriterium {uuid:"' + tbm_id  + '"}),(tsb:Trendsteckbrief {id :"TSB'+ftrend[j]+'"}) return *')

    }


}

console.log(array);

//此查询的样本结果

MATCH (qck:QuickCheckKriterium {uuid:"T1"}),(tsb:Trendsteckbrief {id :"TSB21"}) return *',

'MATCH (qck:QuickCheckKriterium {uuid:"T2"}),(tsb:Trendsteckbrief {id :"TSB21"}) return *',

MATCH (qck:QuickCheckKriterium {uuid:"T1"}),(tsb:Trendsteckbrief {id :"TSB23"}) return *',

'MATCH (qck:QuickCheckKriterium {uuid:"T2"}),(tsb:Trendsteckbrief {id :"TSB23"}) return *'

1 个答案:

答案 0 :(得分:0)

您可以使用UNION:

console.log(array.join(' UNION '))

[https://neo4j.com/docs/developer-manual/current/cypher/clauses/union/]