typeteca-mongoose
v1.0.0
Published
Typeteca integration for Mongoose ODM
Downloads
4
Maintainers
Readme
Typeteca-Mongoose
Package helps easily integrate Typeteca Types into Mongoose Schema registry, using one tiny method.
Installing
npm i typeteca-mongoose
Usage
const mongoose = require('mongoose')
const {Email, Password} = require('typeteca')
const {registerNewType} = require('typeteca-mongoose')
// register dynamically and get new type returned
const User = new mongoose.Schema({
email: registerNewType(Email)
})
// ...or use new types through Schema registry
registerNewType(Password)
User.add({
password: mongoose.Schema.Types.Password
})
Note
- This package uses
mongoose
peer dependency, therefore it will use your locally installed version.
License
This project is licensed under the MIT License - see the LICENSE file for details.