Schema
Defining the structure of documents within a
collection
A schema (Schema) defines the structure of documents within a collection.
Note: These methods below can only be called using the MerlinDB instance, for example: new MerlinDB().methodX().
Creating a Schema (Access): Creating a new Schema;
schema.types (Access): Allowed data types;
schema.unique (Access): Ensures that the value of a field is unique;
schema.required (Access): Ensures that a field is mandatory;
schema.minLength (Access): Defines the minimum number of characters for a field;
schema.maxLength (Access): Defines the maximum number of characters for a field;
schema.min (Access): Define a minimum value allowed for a numeric field;
schema.max (Access): Define a maximum value allowed for a numeric field;;
schema.minList (Access): Define a minimum value of indices in an array;
schema.maxList (Access): Define a maximum value of indices in an array;
schema.validateEmail (Access): Validate a field of type email;
schema.enum (Access): Define a restricted set of possible values for a field;
schema.encrypt (Access): Encrypts values of a field with AES in MerlinDB;
schema.validate (Access): Validate documents with specific rules in MerlinDB.