Napoleonic Political Magnificence
Have ideas to improve npm?Join in the discussion! »

mongoose-imei

2.0.0 • Public • Published

mongoose-imei

Build Status

Gives you the Imei type to use in your schemas, complete with validation using node-imei library. https://en.wikipedia.org/wiki/International_Mobile_Equipment_Identity

Usage

Start with an npm install --save mongoose-imei

const mongoose = require('mongoose');
const imei = require('mongoose-imei');
 
const Schema = mongoose.Schema;
 
imei.loadType(mongoose);
 
const PhoneSchema = new Schema({
  phone: { type: Schema.Types.Imei },
});
 
const PhoneModel = mongoose.model('Phone', PhoneSchema);
 
const phone = new PhoneModel({
  imei: '351680077319519',
});

This type will validate the entry and return an error if a wrong value is given.

Keywords

Install

npm i mongoose-imei

DownloadsWeekly Downloads

4

Version

2.0.0

License

MIT

Unpacked Size

3.96 kB

Total Files

6

Last publish

Collaborators

  • avatar