When to use BaseDocument or HippoCompound

Dear community,

I was searchingto find the difference and why use/extend those two classes, but not a clear answer. I hopeyou can expalin me better

Hi andorian,

from Content Model Concepts - Bloomreach Experience Manager (PaaS/Self-Hosted) - The Fast and Flexible Headless CMS

Document Type

A document type defines the data structure and the editing template of a class of documents. A document type can contain both primitive and compound type fields.

Compound Type

A compound type defines the data structure and the editing template of a reusable block of document fields. A compound type can contain both primitive and compound type fields. An instance of a compound type can only exist within a document instance.

Either can be selected while creating document types in the Document Type editor

Thank for your answer.

So means if i want to created a custom document type and in this document type has a:

  • imagelink and/or
  • link
  • resource
  • rich text

I must extends HippoCompound

If the custom document type has not any of the above I just extends BaseDocument, is that correct?

Thans in advance

Hi,
It’s not a matter of whether the document type contains such fields, it’s a matter of whether you are designing your data structure in reusable field groups, a.k.a. compounds.

Your example seems to not have that, so use BaseDocument for your custom document type.

Jeroen