Graph 类型错误:对象#<;ShapedJson>;没有方法';指数';

Graph 类型错误:对象#<;ShapedJson>;没有方法';指数';,graph,arangodb,Graph,Arangodb,我正在尝试对来自的查询进行修改。我希望做一些进一步的顶点过滤,这样我就可以定制前十名(让它成为给定年份中角色最多的前十名演员或类似的角色) 如果尝试使用Neights函数,则会出现以下错误: arangosh [_system]> db._createStatement({query: 'FOR vert IN imdb_vertices FILTER vert.type == "Person" LET edge_count = (LENGTH(NEIGHBORS(imdb_vertice

我正在尝试对来自的查询进行修改。我希望做一些进一步的顶点过滤,这样我就可以定制前十名(让它成为给定年份中角色最多的前十名演员或类似的角色)

如果尝试使用Neights函数,则会出现以下错误:

arangosh [_system]> db._createStatement({query: 'FOR vert IN imdb_vertices FILTER vert.type == "Person" LET edge_count = (LENGTH(NEIGHBORS(imdb_vertices, imdb_edges, vert, "outbound", [{"type": "Role", "$label": "ACTS_IN"}]))) SORT edge_count DESC LIMIT 10 RETURN {"name": vert.name,  "count": edge_count}'}).execute().toArray()
JavaScript exception in file '/usr/share/arangodb/js/client/modules/org/arangodb/arangosh.js' at 101,13: TypeError: TypeError: Object #<ShapedJson> has no method 'indexOf'
!      throw new TypeError(requestResult.errorMessage);
!            ^
stacktrace: TypeError: TypeError: Object #<ShapedJson> has no method 'indexOf'
    at Object.exports.checkRequestResult (/usr/share/arangodb/js/client/modules/org/arangodb/arangosh.js:101:13)
    at ArangoStatement.execute (/usr/share/arangodb/js/client/modules/org/arangodb/arango-statement.js:171:12)
    at (shell):1:290
arangosh[\u system]>db.\u createStatement({query:'FOR vert IN imdb\u texts FILTER vert.type==“Person”LET edge\u count=(长度(邻域(imdb\u texts,imdb\u edges,vert,“outbound”,“outbound”,“type:”Role“,“$label:”act\u IN”}]))对edge\u count DESC限制进行排序10返回{“name”:vert.name,“count”:edge\u count})。execute().toArray()
文件“/usr/share/arangodb/js/client/modules/org/arangodb/arangosh.js”中101,13:TypeError:TypeError:Object#中的JavaScript异常没有方法“indexOf”
!      抛出新类型错误(requestResult.errorMessage);
!            ^
stacktrace:TypeError:TypeError:Object#没有“indexOf”方法
在Object.exports.checkRequestResult(/usr/share/arangodb/js/client/modules/org/arangodb/arangosh.js:101:13)
在arangostation.execute(/usr/share/arangodb/js/client/modules/org/arangodb/arango statement.js:171:12)
在(壳牌):1:290
由于邻居似乎同时返回边和顶点(与返回边的边不同),我认为问题可能在于此,因此我尝试使用路径:false选项进行遍历。 不幸的是,它给出了相同的错误:

db._createStatement({query: 'FOR vert IN imdb_vertices FILTER vert.type == "Person" LET edge_count = (LENGTH(TRAVERSAL(imdb_vertices,imdb_edges, vert, "outbound", {paths: false, followEdges: [{"type": "Role", "$label": "ACTS_IN"}]}))) SORT edge_count DESC LIMIT 10 RETURN {"name": vert.name,  "count": edge_count}'}).execute().toArray()
JavaScript exception in file '/usr/share/arangodb/js/client/modules/org/arangodb/arangosh.js' at 101,13: TypeError: TypeError: Object #<ShapedJson> has no method 'indexOf'
!      throw new TypeError(requestResult.errorMessage);
!            ^
stacktrace: TypeError: TypeError: Object #<ShapedJson> has no method 'indexOf'
    at Object.exports.checkRequestResult (/usr/share/arangodb/js/client/modules/org/arangodb/arangosh.js:101:13)
    at ArangoStatement.execute (/usr/share/arangodb/js/client/modules/org/arangodb/arango-statement.js:171:12)
    at (shell):1:318
db.\u createStatement({query:'FOR vert IN imdb_texts FILTER vert.type==“Person”LET edge_count=(长度(遍历(遍历(imdb_texts,imdb_edges,vert,“outbound”,{path:false,followEdges:[{“type”:“Role”,“$label”:“act_IN”}]))对边进行排序_count DESC LIMIT 10返回{“name”:vert.name,“count”:edge_count})。执行().toArray()
文件“/usr/share/arangodb/js/client/modules/org/arangodb/arangosh.js”中101,13:TypeError:TypeError:Object#中的JavaScript异常没有方法“indexOf”
!      抛出新类型错误(requestResult.errorMessage);
!            ^
stacktrace:TypeError:TypeError:Object#没有“indexOf”方法
在Object.exports.checkRequestResult(/usr/share/arangodb/js/client/modules/org/arangodb/arangosh.js:101:13)
在arangostation.execute(/usr/share/arangodb/js/client/modules/org/arangodb/arango statement.js:171:12)
在(壳牌):1:318

有人能解释我为什么会犯这个错误吗

我认为问题在于上述查询中的vert是一个顶点对象,但它应该是一个顶点id(或顶点键)。这就是异常发生的原因

第一个查询可以修改如下:

db._createStatement({query: 'FOR vert IN imdb_vertices FILTER vert.type == "Person" LET edge_count = (LENGTH(NEIGHBORS(imdb_vertices, imdb_edges, vert._id, "outbound", [{"type": "Role", "$label": "ACTS_IN"}]))) SORT edge_count DESC LIMIT 10 RETURN {"name": vert.name,  "count": edge_count}'}).execute().toArray()

美好的这是可行的,但我想知道为什么。你能解释一下为什么我需要传递vert.\u id到邻居和遍历,但是边在某种程度上只需要vert就可以了吗?