1.0.0 • Published 7 years ago

typeteca-mongoose v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

Typeteca-Mongoose

NPM

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.