After reading a blog post by Jan about shapes, it looks like there is a shape created for every unique document structure – is that right? What about nested objects in documents? Do they result in new shapes too, or can shapes also be nested? Is there a performance boost for sub-sub-(…)-attribute access if it’s a single shape, or just storage space savings?
]]>So if you modify existing documents and add additional fields, ArangoDB will automatically detect that they have a different shape and use that new shape.
Note that a collection may contain documents of different shapes. That is indeed the normal case. The assumption is that the number of shapes for a collection is much smaller than the number of documents in that collection (though one can of course construct pathological cases where the = = 2 to the power of ;-).
And an index will index all documents in a collection (if they have the index key attribute) independent of their shape (i.e. independent of the other attributes they may or may not contain). It follows that you do not need to rebuild an index when you modify documents in such a way that they have a new shape.
You cannot directly access the shape of a document. And so you cannot directly retrieve all documents with shape . But remember that the shape reflects the existence and types of attributes. And you can access that. So you can retrieve all documents that have attribute . In that way you can indirectly retrieve documents of a certain shape.
Hope this answers you questions.
]]>]]>