papr

MongoDB TypeScript-aware Models

Stats

StarsIssuesVersionUpdatedCreatedSize
papr
17452.2.02 days ago8 months agoMinified + gzip package size for papr in KB

Readme

Papr

Papr

  • TypeScript-safe schemas
  • JSON Schema MongoDB validation
  • :tada: Lightweight library
  • :rocket: Blazing fast

Github Actions NPM version Install size

papr is a lightweight library built around the MongoDB NodeJS driver, written in TypeScript.

papr uses MongoDB's JSON Schema validation feature to enable validation of document writes at runtime (requires MongoDB 3.6+).

papr has a familiar API - if you have used the raw mongodb methods to query and change documents before, then you already know how to use papr.

Sample code

import Papr, { schema, types } from 'papr';

const papr = new Papr();

const User = papr.model('users', schema({
  age: types.number(),
  firstName: types.string({ required: true }),
  lastName: types.string({ required: true }),
}));

const johnWick = await User.find({ firstName: 'John', lastName: 'Wick' });

Documentation

Read the documentation at: plexinc.github.io/papr

Contributing

This repository is following the Conventional Commits standard.

License

MIT

Inspiration

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.