var g = orient.getGraph();
var sqlClassRecords =' select * from' + paramClass;
var listRecords = g.command(' sql',sqlClassRecords);
return listRecords;
上面的行提供了元数据加上out和in的值。就像这样:
[ { " @ type":" d", " @ rid":"#46:0", " @ version":1, " @ class":" relatedTo", " out":"#28:1", "在":"#28:2", " @ fieldTypes":" out = x,in = x" } ]
如何使用js函数获取此值(#28:1)和(#28:2)值。 listRecords [i] .getRecord()。field(" out")工作不正常。它给出顶点类和rids。我只想要rids。
答案 0 :(得分:1)
你只需要添加另一个getRecord()。field()来获取它的rids:
var g = orient.getGraph();
var sqlClassRecords = 'select * from ' + paramClass;
var listRecords = g.command('sql',sqlClassRecords);
var result = [];
for(var i = 0; i < listRecords.length; i++)
{
var out_ = listRecords[i].getRecord().field('out').getRecord().field('@rid').toString();
var in_ = listRecords[i].getRecord().field('in').getRecord().field('@rid').toString();
result.push(new Array("out: " + out_, "in: " + in_));
}
return result;