简体   繁体   中英

Is it possible to create a unique constraint on a sub-key in ArangoDB?

Context

We are limited by ArangoDB's recommendation against using attribute names starting with an underscore _ https://www.arangodb.com/docs/stable/data-modeling-naming-conventions-attribute-names.html because we want to be certain that any such attribute would not be used by ArangoDB at a later stage.

We could add an attribute

properties:{myproperty1:'abc',_myUnderscoreProperty:'def'} ,

but in case we would do this for documents representing users, which would have

properties:{_name:'abc',_email:'abc@graphileon.com'} ,

we would need to be able to create a unique constraint on properties._name . But this does not seem to be possible.

Question

Is this possible or there a workaround?

Yes, it is possible. You can create a unique index on field properties._name

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM