TypeError: Object # <ShapedJson> does not have a method 'indexOf'
I am trying to make a request variant of this answer . I was hoping to do further vertex filtering so that I could set up the top ten (make it the top ten actors with most roles for a given year or something like that).
If I try to use the NEIGHBORS function, I get the following error:
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
Since NEIGHBORS returns both edges and vertices (unlike EDGES, which returns edges), I decided that the problem could be this, so I tried using TRAVERSAL to use the path: false option. Unfortunately, this gives the same error:
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
Can someone explain why I am getting this error?
+4
1
, , vert , , _id ( vertex _key). .
:
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()
+5