项目
在 GitHub 查看
plexinc/papr
关于
支持 TypeScript 的 MongoDB 模型
开发工具实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文Papr
- TypeScript-safe schemas
- JSON Schema MongoDB validation
- :tada: Lightweight library
- :rocket: Blazing fast
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
Please read the contributing guidelines.
Before contributing, please read the Code of conduct.
License
MIT
Inspiration
探索相关项目
加载中…