user3792971
user3792971

Reputation: 11

ArangoDB document nested property naming convention and indexing limitations

Problem: indexing nested property in arangodb

Context: ArangoDB, community edition, running localy

Description: I have a collection CONFIGURATIONS_NODES hosting documents with the following structure

{ "_sectionName": "MySection", "_configurationName": "abc", "nodeData": { "_id": "61cc20793b83b2001c24a9ad", "configuration_name": "xyz" }

If I run a query "for v in CONFIGURATIONS_NODES filter v.nodeData._id=="61cc20793b83b2001c24a9ad" return v". It finds the document as expected but alas its a full scan.

If I try to create an index on the nested nodeData._id property the index creation fails. I was able to create an index on the nested property nodeData.configuration_name. so it seems the issue relates only to the nested _id

Upvotes: 1

Views: 70

Answers (1)

mpoeter
mpoeter

Reputation: 2949

The documentation states:

You cannot use the _id system attribute in user-defined indexes, but indexing _key, _rev, _from, and _to is possible.

The name _id conflicts with the internal _id attribute and is treated specially. Even though it is not mentioned in the documentation, this means that attributes named _id cannot be indexed, not even in nested subobjects.

Upvotes: 1

Related Questions