【问题标题】:Gremlin get count in javascript AWS LambdaGremlin 在 javascript AWS Lambda 中获得计数
【发布时间】:2018-07-24 23:13:40
【问题描述】:

我正在尝试通过 AWS lambda 获取图表的边数 但是出现错误

g.V(...).inE(...).outV(...).count(...).then is not a function

我的 lambda 代码是:

const gremlin = require('gremlin');
const DriverRemoteConnection = gremlin.driver.DriverRemoteConnection;
const Graph = gremlin.structure.Graph;

exports.handler = (event, context, callback) => {    
    let dc = new DriverRemoteConnection('ws://<endpoint>:8182/gremlin');

    const graph = new Graph();
    const g = graph.traversal().withRemote(dc);

    g.V('19071640').inE('friend').count().then(num => console.log(num));
}

如果我这样做,它会起作用

g.V('19071640').inE('friend').outV().then(friends => console.log(friends));

【问题讨论】:

    标签: javascript amazon-web-services gremlin


    【解决方案1】:

    我认为你需要iterate your traversal

    g.V('19071640').inE('friend').count().next().then(num => console.log(num));
    

    【讨论】:

      猜你喜欢
      • 2017-09-20
      • 2020-06-08
      • 1970-01-01
      • 2016-11-30
      • 2017-02-15
      • 1970-01-01
      • 2016-07-26
      • 2019-06-27
      • 2021-06-05
      相关资源
      最近更新 更多