1.0.2 • Published 9 years ago

mongoose-iban v1.0.2

Weekly downloads
4
License
MIT
Repository
github
Last release
9 years ago

mongoose-iban

Gives you the Iban type to use in your schemas, complete with validation using the excellent arhs/iban library. An IBAN is a type of bank account number used extensively in Europe.

Usage

Start with an npm install --save mongoose-iban

var mongoose = require('mongoose');
var Schema = mongoose.Schema;

require('mongoose-iban').loadType(mongoose);

var Iban = Schema.Types.Iban;

var BankAccountSchema = new Schema({
  accountNumber: { type: Iban }
});

var BankAccountModel = mongoose.model('BankAccount', BankAccountSchema);

var bankAccount = new BankAccountModel({
  accountNumber: 'NL39 RABO 0300 0652 64'
});

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