Specifies that the field is not persistent. It is used to specify which field of your bookshelf models will not be saved on database.
After installing bookshelf-transient
with npm i --save bookshelf-transient
,
all you need to do is add it as a bookshelf plugin and enable it on your models.
let knex = require('knex')(require('./knexfile.js').development)
let bookshelf = require('bookshelf')(knex)
// Add the plugin
bookshelf.plugin(require('bookshelf-transient'))
// Enable it on your models
let User = bookshelf.Model.extend({ tableName: 'users', transient: [ 'password', 'confirm_password' ] })
Nothing fancy here, just keep using bookshelf as usual.
git clone git@github.com:leonardom/bookshelf-transient.git
cd bookshelf-transient && npm install && npm test