@meanie/joi-object-id
v2.3.0
Published
A Joi extension to validation MongoDB ObjectId formats
Downloads
506
Maintainers
Readme
@meanie/joi-object-id
A Joi extension to automatically convert ISO date strings to object-id objects
Features
- Extends the existing
string
validator - Validates incoming values as MongoDB ObjectId values
- Automatically converts values to Mongoose
ObjectId
instances
Installation
#npm
npm install @meanie/joi-object-id
#yarn
yarn add @meanie/joi-object-id
Usage
const Joi = require('@hapi/joi');
const JoiObjectId = require('@meanie/joi-object-id');
module.exports = Joi.extend(JoiObjectId);
Examples
const schema = Joi.object({
user: Joi.string().objectId(),
});
Issues & feature requests
Please report any bugs, issues, suggestions and feature requests in the meanie-joi-object-id issue tracker.
Contributing
Pull requests are welcome! If you would like to contribute to Meanie, please check out the Meanie contributing guidelines.
Sponsor
This package has been kindly sponsored by Hello Club, an all in one club and membership management solution complete with booking system, automated membership renewals, online payments and integrated access and light control. Check us out if you happen to belong to any kind of club or if you know someone who helps run a club!
License
(MIT License)
Copyright 2019-2020, Adam Reis