1.0.1 • Published 2 years ago
mongo-object-id-class-validator v1.0.1
Mongo ObjectId Class Validator
This package validates Mongo ObjectId.
How to install
npm i -S mongo-object-id-class-validator
How to use
Here is an example along with commonly used IsString
from class-validator
package.
import { IsString } from 'class-validator';
import { IsObjectId } from 'mongo-object-id-class-validator';
class UserDTO {
@IsObjectId()
id: string;
@IsString()
name: string;
}