In ArangoDB, when a collection is defined to allow user defined keys, what are the restrictions on the value of the key? For example, it appears that a key of "Name-2"
works but a key of "Name,2"
gives ArangoError 1221: invalid document key
error.
Asked
Active
Viewed 1,792 times
7

WiredPrairie
- 58,954
- 17
- 116
- 143
2 Answers
9
Quoting from the manual
- The key must be a string value. Numeric keys are not allowed, but any numeric value can be put into a string and can then be used as document key.
- The key must be at least 1 byte and at most 254 bytes long. Empty keys are disallowed when specified (though it may be valid to completely omit the
_key
attribute from a document) - It must consist of the letters
a-z
(lower or upper case), the digits0-9
or any of the following punctuation characters:_
-
:
.
@
(
)
+
,
=
;
$
!
*
'
%
- Any other characters, especially multi-byte UTF-8 sequences, whitespace or punctuation characters cannot be used inside key values
- The key must be unique within the collection it is used
Keys are case-sensitive, i.e. myKey
and MyKEY
are considered to be different keys.

stj
- 9,037
- 19
- 33
-
Thanks for the link, we just couldn't seem to find the right spot in the manual! – WiredPrairie Dec 04 '14 at 16:10
-
@stj The restrictions changed in the meanwhile, maybe you could edit your post. Commas are now valid according to the documentation. New documentation link (yours point to the index): https://docs.arangodb.com/3.4/Manual/DataModeling/NamingConventions/DocumentKeys.html – Alexis R Apr 05 '19 at 12:33
1
Restrictions (or naming conventions) for user defined keys can be found in docs here.

yojimbo87
- 65,684
- 25
- 123
- 131
-
Thanks for the link, we just couldn't seem to find it in the manual! – WiredPrairie Dec 04 '14 at 16:12