pebble / joi-objectid

A MongoDB ObjectId validator for Joi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

var Joi = require('joi');
Joi.objectId = require('joi-objectid')(Joi);

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

Installation

npm install joi-objectid --save

Development

running tests

  • make test

Sponsored by

Pebble Technology!

License

MIT

About

A MongoDB ObjectId validator for Joi

License:MIT License


Languages

Language:JavaScript 97.2%Language:Makefile 2.8%