1

How to fix AQL syntax error? I'm trying to create an edge using a query, but the following error appears:

Failed to execute query. Response: 400, Error: 1501 - AQL: syntax error, unexpected end of query string near '@edges' at position 1:57 (while parsing)

The code used to execute the query:

try {

 String query = "INSERT { _from:TurmaA._teste2, _to:TurmaA._testepedro } IN @edges";
 Map<String, Object> bindVars = new MapBuilder().put("edges", nome2).get();
 ArangoCursor<BaseDocument> cursor = arangoDB.db(dbName).query(query, bindVars, 
null, BaseDocument.class);

cursor.forEachRemaining(aDocument -> {
  System.out.println("Key: " + aDocument.getKey());
 });
} catch (ArangoDBException e) {
 System.err.println("Failed to execute query. " + e.getMessage());
}
0

1 Answer 1

1

Please note that collection bind variables have to be prefixed by two @@.

So your code example can probably be easily fixed like this:


try {

 String query = "INSERT { _from:TurmaA._teste2, _to:TurmaA._testepedro } IN @@edges";
 Map<String, Object> bindVars = new MapBuilder().put("@edges", nome2).get();
 ArangoCursor<BaseDocument> cursor = arangoDB.db(dbName).query(query, bindVars, 
null, BaseDocument.class);

cursor.forEachRemaining(aDocument -> {
  System.out.println("Key: " + aDocument.getKey());
 });
} catch (ArangoDBException e) {
 System.err.println("Failed to execute query. " + e.getMessage());
}
Sign up to request clarification or add additional context in comments.

3 Comments

thanks! that did work, but now i have another problem... it says collection or view not found: testepedro but i checked and it is in the right collection
Please try it out on the webinterface, It offers more easy means of debugging. Please note that its case sensitive.
very helpfull I was trying to find this

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.