---
# System prepended metadata

title: Validations

---

# Validations

### Hotel
```
{
  $jsonSchema: {
    required: [
      'name',
      'address'
    ],
    properties: {
      name: {
        bsonType: 'string'
      },
      address: {
        bsonType: 'object',
        required: [
          'country',
          'state',
          'city',
          'street',
          'number',
          'cep'
        ],
        properties: {
          country: {
            bsonType: 'string'
          },
          state: {
            bsonType: 'string'
          },
          city: {
            bsonType: 'string'
          },
          street: {
            bsonType: 'string'
          },
          number: {
            bsonType: 'string'
          },
          cep: {
            bsonType: 'string',
            maxLength: 8
          }
        }
      }
    }
  }
}
```
### Room
```
{
  $jsonSchema: {
    required: [
      'number',
      'hotel_id',
      'type',
      'accessible',
      'daily_price'
    ],
    properties: {
      number: {
        bsonType: 'string'
      },
      hotel_id: {
        bsonType: 'objectId'
      },
      type: {
        'enum': [
          'Single',
          'Double',
          'Family',
          'Presidential'
        ]
      },
      accessible: {
        bsonType: 'bool'
      },
      daily_price: {
        bsonType: [
          'double'
        ]
      }
    }
  }
}
```
### Customer
```
{
  $jsonSchema: {
    required: [
      'cpf',
      'name',
      'address',
      'nationality',
      'email',
      'phone'
    ],
    properties: {
      cpf: {
        bsonType: 'string',
        maxLength: 11
      },
      name: {
        bsonType: 'string'
      },
      address: {
        bsonType: 'object',
        required: [
          'country',
          'state',
          'city',
          'street',
          'number',
          'cep'
        ],
        properties: {
          country: {
            bsonType: 'string'
          },
          state: {
            bsonType: 'string'
          },
          city: {
            bsonType: 'string'
          },
          street: {
            bsonType: 'string'
          },
          number: {
            bsonType: 'string'
          },
          cep: {
            bsonType: 'string',
            maxLength: 8
          }
        }
      },
      nationality: {
        bsonType: 'string'
      },
      email: {
        bsonType: 'string'
      },
      phone: {
        bsonType: 'string',
        maxLength: 9
      }
    }
  }
}
```

###

### Reservation
```
{
  $jsonSchema: {
    required: [
      'employee',
      'room_id',
      'customer_id',
      'canceled',
      'total_value',
      'payment_method',
      'start_date',
      'end_date'
    ],
    properties: {
      employee: {
        bsonType: 'string'
      },
      room_id: {
        bsonType: 'objectId'
      },
      customer_id: {
        bsonType: 'objectId'
      },
      canceled: {
        bsonType: 'bool'
      },
      total_value: {
        bsonType: 'double'
      },
      payment_method: {
        'enum': [
          'money',
          'pix',
          'debit card',
          'credit card'
        ]
      },
      start_date: {
        bsonType: 'date'
      },
      end_date: {
        bsonType: 'date'
      }
    }
  }
}
```
### Employee

```
{
  $jsonSchema: {
    required: [
      'cpf',
      'name',
      'position'
    ],
    properties: {
      cpf: {
        bsonType: 'string',
        maxLength: 11
      },
      name: {
        bsonType: 'string'
      },
      position: {
        'enum': [
          'attendant',
          'manager',
          'janitor',
          'laundry',
          'cook'
        ]
      }
    }
  }
}
```