@types/mongoose-id-validator
Version:
TypeScript definitions for mongoose-id-validator
50 lines (39 loc) • 1.83 kB
Markdown
# Installation
> `npm install --save @types/mongoose-id-validator`
# Summary
This package contains type definitions for mongoose-id-validator (https://github.com/CampbellSoftwareSolutions/mongoose-id-validator).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mongoose-id-validator.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mongoose-id-validator/index.d.ts)
````ts
import { Connection, Schema } from "mongoose";
interface MongooseIdValidatorOptions {
/* Optional, custom validation message with {PATH} being replaced
* with the relevant schema path that contains an invalid
* document ID.
*/
message?: string | undefined;
/* Optional, mongoose connection object to use if you are
* using multiple connections in your application.
*
* Defaults to built-in mongoose connection if not specified.
*/
connection?: Connection | undefined;
/* Optional, applies to validation of arrays of ID references only. Set
* to true if you sometimes have the same object ID reference
* repeated in an array. If set, the validator will use the
* total of unique ID references instead of total number of array
* entries when checking the database.
*
* Defaults to false
*/
allowDuplicates?: boolean | undefined;
}
declare function mongooseIdValidator(schema: Schema, options?: MongooseIdValidatorOptions): void;
export = mongooseIdValidator;
````
### Additional Details
* Last updated: Tue, 07 Nov 2023 09:09:39 GMT
* Dependencies: [@types/node](https://npmjs.com/package/@types/node), [mongoose](https://npmjs.com/package/mongoose)
# Credits
These definitions were written by [Kerollos Magdy](https://github.com/kerolloz).