NOÉ is searching for a volunteer dev ! Interested ? Send an email to hello@noe-app.io.
Skip to main content

Nested fields

Complete guide to manipulating nested fields in the NOÉ API, including custom fields and complex objects.

📋 Overview​

NOÉ objects can contain nested fields like customFields, formAnswers, and other complex structures. This documentation explains how to manipulate them efficiently.

🎯 Types of nested fields​

1. Custom fields (customFields)​

Custom fields let you add extra properties to objects (see the "Custom fields" tab in the "Event configuration" page).

Example structure:

{
"_id": "507f1f77bcf86cd799439011",
"name": "The mediactivist tools",
"customFields": {
"difficulty": "Beginner",
"track": "Communication & media"
},
...
}

2. Form answers (formAnswers)​

Used in registrations to store the answers to the registration form.

Example:

{
"_id": "507f1f77bcf86cd799439012",
"user": "68831872fcb40efc458b2581",
"formAnswers": {
"diet": "Vegetarian",
"skills": "I am good with computers and play the djembe ;)",
"phone": "+33 6 12 34 56 78"
}
}
}

3. Availabilities and slots​

Used for time slots and availabilities for projects, stewards and places.

Example:

{
"availabilitySlots": [
{
"start": "2024-03-15T09:00:00.000Z",
"end": "2024-03-15T12:00:00.000Z"
},
{
"start": "2024-03-15T14:00:00.000Z",
"end": "2024-03-15T17:00:00.000Z"
}
]
}

✏️ Modifying nested fields​

Use dot notation to modify specific fields without affecting the rest.

Syntax​

{
"customFields.field1": "new_value",
"customFields.field2": "other_value"
}

Practical examples​

Modify a simple field:

{
"customFields.difficulty": "Intermediate"
}

Add/modify an element in an array: Careful: this replaces the element currently at that index, if there is one.

{
"customFields.materials.1": "Djembe"
}

Method 2: Total modification​

Completely replace the nested object.

Warning

This method deletes all the fields not included in the request.

{
"customFields": {
"difficulty": "advanced",
"duration": "3h",
"newField": "new value"
}
}

Clearing fields​

Use null to delete specific fields:

{
"customFields.oldField": null
}