npm.io
0.6.6 • Published 2 years ago

@types/mongoose-id-validator

Licence
MIT
Version
0.6.6
Deps
2
Size
5 kB
Vulns
0
Weekly
0
Stars
51.4K

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

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

Credits

These definitions were written by Kerollos Magdy.