Skip to main content

eq

$eq

Do a deep equality check between the value and the provided constraint value.

Parameters

  • value (any, required): The value to compare against using deep equality.

Example

// Ensure a status field can only be 'active'
new Schema('string').validator({$eq: 'active'})

// Ensure an object matches an exact structure
new Schema('object').validator({$eq: {type: 'config', version: 1}})