Skip to content

mtimofiiv/mongoose-iban

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Releases

No releases published

Packages

No packages published