joi-objectid

4.0.2 • Public • Published

joi-objectid

A MongoDB ObjectId validator for Joi.

Build Status

use

joi-objectid validates that the value is an alphanumeric string of 24 characters in length.

It's used just like you'd use any other Joi type.

const Joi = require('@hapi/joi')
Joi.objectId = require('joi-objectid')(Joi)

const schema = Joi.object({
  id: Joi.objectId(),
  name: Joi.string().max(100),
  date: Joi.date()
})

Installation

npm install joi-objectid --save

Development

running tests

  • npm test

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i joi-objectid

Weekly Downloads

29,251

Version

4.0.2

License

MIT

Unpacked Size

5.88 kB

Total Files

7

Last publish

Collaborators

  • mkg20001