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

0.0.14 • Public • Published

Mongo io-ts wrapper

Build Status code style: prettier Known Vulnerabilities

Strongly typed mongod db with runtime validation and typescript intellisense.

Usage

Define your interfaces with io-ts

import * as t from 'io-ts';
 
const User = t.interface({
    dateCreated: t.number;
    namet.string;
    emailt.string;
});

Use mongo wrapper to define users collection

const mongoClient = mongoWrapper({
    Collections: {
        users: User
    }
});

Get intellisense

intellisense-preview

Get runtime validation

Invalid value "NotANumber" supplied to : { email: string , dateCreated: number, password: string }/dateCreated: number

Package Sidebar

Install

npm i mongo-iots-wrapper

Weekly Downloads

0

Version

0.0.14

License

MIT

Unpacked Size

75.9 kB

Total Files

31

Last publish

Collaborators

  • dderevjanik
  • jurajkocan