mongo-sanity
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

mongo-sanity

mongo-sanity is a library designed to validate MongoDB documents against a predefined schema. It ensures that the documents stored in your MongoDB collections adhere to the specified structure and constraints.

Features

  • Schema Validation: Validate MongoDB documents against a predefined schema.
  • Custom Validators: Define custom validation rules for specific fields.
  • Error Reporting: Detailed error messages for validation failures.
  • Flexible Schema Definitions: Support for various data types and nested schemas.

Installation

To install the library, use npm or yarn:

npm install mongo-sanity

Usage

import mongoose from 'mongoose';
import { connectToDatabaseAndValidateData } from 'mongo-sanity';

// Model initialization

await connectToDatabaseAndValidateData(mongoose);

/mongo-sanity/

    Package Sidebar

    Install

    npm i mongo-sanity

    Weekly Downloads

    0

    Version

    1.0.1

    License

    ISC

    Unpacked Size

    39.3 kB

    Total Files

    8

    Last publish

    Collaborators

    • axelmth