Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the user defined key's value restrictions?

Tags:

arangodb

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.

like image 772
WiredPrairie Avatar asked Dec 04 '14 15:12

WiredPrairie


2 Answers

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 digits 0-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.

like image 138
stj Avatar answered Nov 19 '22 05:11

stj


Restrictions (or naming conventions) for user defined keys can be found in docs here.

like image 33
yojimbo87 Avatar answered Nov 19 '22 04:11

yojimbo87