core/server/models/base/index.js
function toJSON(unfilteredOptions) {
        const options = ghostBookshelf.Model.filterOptions(unfilteredOptions, 'toJSON');
        options.omitPivot = true;

        // CASE: get JSON of previous attrs
        if (options.previous) {
            const clonedModel = _.cloneDeep(this);
            clonedModel.attributes = this._previousAttributes;

            if (this.relationships) {
                this.relationships.forEach((relation) => {
                    if (this._previousRelations && this._previousRelations.hasOwnProperty(relation)) {
                        clonedModel.related(relation).models = this._previousRelations[relation].models;
                    }
                });
            }

            return proto.toJSON.call(clonedModel, options);
        }

        return proto.toJSON.call(this, options);
    }
function toJSON(unfilteredOptions) {
        const options = ghostBookshelf.Model.filterOptions(unfilteredOptions, 'toJSON');
        options.omitPivot = true;

        // CASE: get JSON of previous attrs
        if (options.previous) {
            const clonedModel = _.cloneDeep(this);
            clonedModel.attributes = this._previousAttributes;

            if (this.relationships) {
                this.relationships.forEach((relation) => {
                    if (this._previousRelations && this._previousRelations.hasOwnProperty(relation)) {
                        clonedModel.related(relation).models = this._previousRelations[relation].models;
                    }
                });
            }

            return proto.toJSON.call(clonedModel, options);
        }

        return proto.toJSON.call(this, options);
    }
function toJSON ( unfilteredOptions ) { const options = ghostBookshelf . Model . filterOptions ( unfilteredOptions , 'toJSON' ) ; options . omitPivot = true ; // CASE: get JSON of previous attrs if ( options . previous ) { const clonedModel = _ . cloneDeep ( this ) ; clonedModel . attributes = this . _previousAttributes ; if ( this . relationships ) { this . relationships . forEach ( ( relation ) => { if ( this . _previousRelations && this . _previousRelations . hasOwnProperty ( relation ) ) { clonedModel . related ( relation ) . models = this . _previousRelations [ relation ] . models ; } } ) ; } return proto . toJSON . call ( clonedModel , options ) ; } return proto . toJSON . call ( this , options ) ; }
`shallow`    - won't return relations
`omitPivot`  - won't return pivot fields

`toJSON` calls `serialize`.

@param unfilteredOptions
@returns {*}
shallow - won t return relations omitPivot - won t return pivot fields