Insectatorious
Insectatorious

Reputation: 1345

AQL: How to specify a collection that has a dash in the name?

I have a collection called one-two and I would like to list a few of the documents in the collection:

FOR v IN one-two
    RETURN v

But I get the following error: Query: AQL: collection or view not found: one (while parsing)

How do I specify the collection with a - in the name?

I've tried the usual options, ', " and camelCasing it oneTwo but they all fail. The ArangoDB documentation Collection and View Names clearly states that a dash (-) is permitted.

Screenshot showing the error

Screenshot showing the collection

Upvotes: 2

Views: 580

Answers (1)

mpoeter
mpoeter

Reputation: 2989

For normal REST requests operating on such a collection no escaping is needed.

However, in AQL a dash (-) can also be interpreted as a minus operator. That's why in a query, a name with a dash has to be put into backticks: `one-two`

But since this is only relevant for AQL, this information can be found in the AQL Syntax documentation, not in the documentation about collection names that you referenced.

Upvotes: 4

Related Questions