node.js - 如何使用 orientjs 针对 OrientDB 执行 Gremlin?

标签 node.js 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)

但是,当我在网络界面中执行 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/

相关文章:

node.js - package-lock.json 中的 "requires: true"有什么作用

java - 使用文档 api 在 orient db 中更新

sql - 从选择中将记录插入到 OrientDB 类的嵌入字段中

orientdb - 从集群名称请求集群 ID

azure-cosmosdb - Cosmos DB 搜索查询采用任意字符的顶点值

graph-databases - gremlin:限制步骤与采取步骤

node.js - 如何使用带有lambda函数的nodejs在aws s3存储桶中创建嵌套文件夹?

node.js - 依赖项 - 未安装错误(npm WARN optional SKIPPING OPTIONAL DEPENDENCY : fsevents@^1. 0.0 (node_modules\chokidar\node_modules\fsevents)

javascript - Javascript 中的异步启动器

azure-cosmosdb - 如何设置 gremlin 控制台以针对本地 Azure CosmosDB 模拟器工作?