Embed Data type
const schema = new Schema({ reviews: { type: [reviewSchema] } })
Last updated
const schema = new Schema({ reviews: { type: [reviewSchema] } })
Last updated
Required: If you choose this option, it means that users must fill in the required fields before submitting data to the database. This ensures that all necessary information is collected and avoids submitting incomplete data. It prompts users to provide input in the designated fields that must be filled.
Ex. It will not take blank fields in the database
Generate Separate Routes:- If you choose this option, the system will generate separate routes for any embedded fields created within the model. It allows for the creation of unique routes specific to the embedded field.
isPrivate: If you choose this option, it means that the system will keep the information entered in that field confidential and hidden from the user. This option is especially helpful when collecting sensitive data that should not be visible to the user.
Ex. It will not be visible to the user in the response
isArray: If you choose this option, it means the selected field will be set up as an array. This option is helpful when storing multiple items as a single entity.
Ex. It will take an array in the field.
unique: If you choose this option, it means that the system will require each value in that field to be different from the others. This is useful when you want to avoid duplicates in specific data fields.
Ex. when the user adds added value for that field, it won't allow taking that value again.
Collection to Reference:- If you choose this option, it means that the system will retrieve a reference from the embedded model for the specified embedded field.
Ex: a schema which you want to give a reference in this field.
Reference Exist:- If you choose this option, it means that the system will verify if the referenced model item already exists in the database before creating the new model. This ensures that the data is accurate and reliable by confirming that all referenced items are valid and available before creating any new items.
is Accessible:- If you choose this option, it means that the system will check if the referenced model item exists in the database and if the field is accessible. This helps to ensure data accuracy and security. This is particularly useful when data privacy is a concern and helps to ensure that only authorized users can access the referenced model item.