Orientdb 在orientjs中执行遍历语句

Orientdb 在orientjs中执行遍历语句,orientdb,orientjs,Orientdb,Orientjs,我正在使用OrientDB图形数据库,我有两个顶点Room和Participant,我在Room和Participant记录之间创建了一些边,我想使用orientjs驱动程序执行以下命令: 更新 我想用这样的东西: db.let('firstSelect', function(s){ s.select().from('room').where({name:'room test 1'}); }).let('traverse', function(s){ s.traverse('

我正在使用OrientDB图形数据库,我有两个顶点Room和Participant,我在Room和Participant记录之间创建了一些边,我想使用orientjs驱动程序执行以下命令:

更新

我想用这样的东西:

db.let('firstSelect', function(s){
     s.select().from('room').where({name:'room test 1'});
}).let('traverse', function(s){
     s.traverse('out()').from('$firstSelect').while('$depth<=1');
}).let('finalSelect', function(s){
     s.select().from('$traverse').where({'@class':'Participant'});
}).commit()
.return('$finalSelect')
.all()
.then(function(participants){
    console.log(participants);
})
将来,我将把这段代码放在一个带有一些参数的函数中

您可以使用db.query API:


希望能有所帮助

谢谢你的回答,但同时我用postgres取代了orientdb。
db.let('firstSelect', function(s){
     s.select().from('room').where({name:'room test 1'});
}).let('traverse', function(s){
     s.traverse('out()').from('$firstSelect').while('$depth<=1');
}).let('finalSelect', function(s){
     s.select().from('$traverse').where({'@class':'Participant'});
}).commit()
.return('$finalSelect')
.all()
.then(function(participants){
    console.log(participants);
})
var OrientDB = require('orientjs');

var server = OrientDB({
    host: 'localhost',
    port: 2424,
    username: 'root',
    password: 'root'
});

var db = server.use({
    name: 'OrientJStest',
    username: 'root',
    password: 'root'
});

db.query('select from (traverse out() from (select from room where name="room test 1")) where @class = :inputClass', {
    params: {
      inputClass: "Participant"
    },
    limit: -1
}).then(function (results) {
    console.log('Vertexes found: ');
    console.log();
    console.log(results);
});