Nested fields are we need to use mandatory for schemas | Community
Skip to main content
Best answer by bjoern__koth

Hi @saiteja_1225  

can you specify what you mean?

in general, nesting is creating a hierarchical structure of fields e.g., by having a field of type object, that may contain attributes which can add even more nesting etc.

 

 

it really comes down to your needs and what kind of structure makes most sense to represent your data. 
I would aim for a fairly flat structure though.

2 replies

bjoern__koth
Community Advisor and Adobe Champion
bjoern__kothCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
July 2, 2025

Hi @saiteja_1225  

can you specify what you mean?

in general, nesting is creating a hierarchical structure of fields e.g., by having a field of type object, that may contain attributes which can add even more nesting etc.

 

 

it really comes down to your needs and what kind of structure makes most sense to represent your data. 
I would aim for a fairly flat structure though.

Cheers from Switzerland!
Level 2
July 2, 2025

Hi @saiteja_1225 

Can you please add more details to your question. Although whether or not nested fields in a schema should be mandatory depends on the specific requirements of your data model and how you intend to use the schema. While nested fields can be made required, it's not always necessary, and doing so can sometimes lead to unintended consequences if not handled carefully.

Understanding Nested Fields and Required Properties:

Nested fields:
These are fields within a schema that themselves have a schema definition, allowing for hierarchical data structures.

Required properties:

In a schema definition, required: true means that the field must be present and have a value when creating or updating a document.