最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

如何使用orientjs对OrientDB执行Gremlin?

运维笔记admin12浏览0评论

如何使用orientjs对OrientDB执行Gremlin?

如何使用orientjs对OrientDB执行Gremlin?

在Node中,对数据库执行Gremlin查询的正确方法是什么?

我目前使用Official Node OrientDB Driver的尝试:

const { ODatabase } = require('orientjs');
const db = new ODatabase({...});
db.query('g.V()')
  .then(console.log, console.error);

我得到:

OrientDB.RequestError: 
  Cannot find a command executor for the command request: sql.g.V()
  DB name="mynevo"
at child.Operation.parseError 
  (.../orientjs/lib/transport/binary/protocol33/operation.js:864:13)

但是,当我在Web界面中执行g.V()时,它运行得很好。

显然,Node驱动程序或服务器假定查询应该是SQL。有没有办法告诉它是Gremlin,还是有其他方法?

回答如下:

您应该能够使用执行gremlin命令

```

db.query('g.V()', { 
        language : "gremlin", 
        class : "com.orientechnologies.orient.graph.gremlin.OCommandGremlin"
    }).then(function(res){
        console.log(res);
    })

```

发布评论

评论列表(0)

  1. 暂无评论