在 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)
但是,当我在网络界面中执行 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);
})
```
关于node.js - 如何使用 orientjs 针对 OrientDB 执行 Gremlin?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43033355/