0.0.14 • Published 8 years ago
mongo-iots-wrapper v0.0.14
Mongo io-ts wrapper
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;
name: t.string;
email: t.string;
});Use mongo wrapper to define users collection
const mongoClient = mongoWrapper({
Collections: {
users: User
}
});Get intellisense

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