Skip to content

Latest commit

 

History

History
107 lines (82 loc) · 1.05 KB

types.md

File metadata and controls

107 lines (82 loc) · 1.05 KB

Data Types

Schema

A schema is used to describe the structure of data. It can be one of:

StringSchema

{
  type :: 'string'
  choices: Array String | Null,
  match: RegExp | Null,
  minLength: Number,
  maxLength: Number
}

NumberSchema

{
  type: 'number'
  min: Number,
  max: Number
}

BooleanSchema

{
  type: 'boolean'
}

BufferSchema

{
  type: 'buffer'
}

DateSchema

{
  type: 'date',
  min: Date || Null,
  max: Date || Null
}

ArraySchema

{
  type: 'array',
  minLength: Number,
  maxLength: Number,
  schema: Schema
}

ObjectSchema

{
  type: 'object',
  fields: StrMap Schema
}

UniqueSchema

{
  type: 'unique',
  schema: Schema
}

MongooseModel

Represents a mongoose model.

RelationType

One of 'one-one' 'one-many' 'many-many'.

Relation

{
  type: RelationType,
  source: {
    name: String,
    field: String || Null,
  },
  target:  {
    name: String,
    field: String || Null,
  }
}