Sails.js 'schema: true' equivalent for response JSON -
i had assumed sails model schema: true
config option worked in 2 directions; i.e. 1. strip out fields not defined in attributes
hash before writing database, , 2. strip out fields in database before serving application (in cases database has data don't need get.
it looks 1, , not 2. correct? if so, there more elegant built in way 2 rather overwriting tojson() method return fields want?
it true schema: true
1 i.e. strip out fields before saving database.
if not want override tojson
, create instance method that.
you consider overriding toobject
if suits use case.
Comments
Post a Comment