arangodb / arangojs

The official ArangoDB JavaScript driver.
https://arangodb.github.io/arangojs
Apache License 2.0
600 stars 106 forks source link

aql query string has a syntax error, but I copy / pasted it from docs #717

Closed enjoysmath closed 3 years ago

enjoysmath commented 3 years ago

This code:

db.query(aql`
    FOR i IN 1..10
        INSERT {
            LaTeX: CONCAT("A_", i),
            _key: i
        } IN mynodes-js`
).then(
    cursor => {
        cursor.all().then(
            vals => {
                // vals is an array containing the entire query result
                console.error(vals);
            });
    });

Is giving me:

node:internal/process/promises:225
          triggerUncaughtException(err, true /* fromPromise */);
          ^
ArangoError: AQL: syntax error, unexpected end of query string near 'js' at position 6:22 (while parsing)
    at new ArangoError (c:\Users\FruitfulApproach\Desktop\Quiver\quiver\node_modules\arangojs\error.js:115:21)
    at Object.resolve (c:\Users\FruitfulApproach\Desktop\Quiver\quiver\node_modules\arangojs\connection.js:406:32)
    at callback (c:\Users\FruitfulApproach\Desktop\Quiver\quiver\node_modules\arangojs\connection.js:191:26)
    at IncomingMessage.<a....

which doesn't make any sense.

enjoysmath commented 3 years ago
    FOR i IN 1..10
        INSERT {
            LaTeX: CONCAT("A_", i),
        } IN mynodesjs`

This works; it didn't like the hyphen.