Virtual Data type
Last updated
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
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.
Virtual Model Reference:- If you choose this option, it means that the system will allow you to create virtual model references to pre-existing models or collections of the "model" type.
Ex: a collection which you want to give a reference in this field.
Local Field:- If you choose this option, it means that the system will retrieve the local field from the model in which the virtual field is created. This allows for the reuse of existing data within the same model and can simplify the data modeling process while reducing the potential for errors or inconsistencies.
Foreign Field:- If you choose this option, it means that the system will retrieve the field from the virtual model reference, which is the model that the virtual field refers to.
Count Only:- If you choose this option, it will return only a number of documents.