handleEnsureRelation |
function
|
<optional>
|
|
A function which will be called
for each relation name in the ensureRelationsLoaded arrays. May return a
promise. See defaultHandleEnsureRelation in the source code for the example of the default
behavior, which, as you'd expect, simply loads the relation on the model if it
is not already present. This option was driven by the Sequiturs use case,
which special-cases relation names ending in 'CountPseudoRelation' in order to
set on the model a 'Count' attribute whose value is the count of rows of the
relation identified by the beginning of the relation name. |
ensureRelationsVisibleAndInvisible |
boolean
|
<optional>
|
false
|
A boolean
which should be true only if you have also specified options.handleEnsureRelation .
It specifies whether the plugin should, before serializing, load all relations
listed in an ensureRelationsLoaded array--that is, whether it should call
options.handleEnsureRelation for each relation listed in an ensureRelationsLoaded
array--, regardless of whether the relations will be visible properties. Default
plugin behavior corresponds to a value of false , which avoids the work of
loading relations that will not be present in the serialization
result. Note that even if this option is true , relations that are not
visible properties will be removed from the model just before serializing--as
is documented for this plugin's Model.toJSON . |
defaultOmitNew |
boolean
|
<optional>
|
|
A boolean which specifies a
default value for the omitNew option to {model,collection}.toJSON(options) . Specifying
this option as true is a performant way to address this Bookshelf bug
(https://github.com/tgriesser/bookshelf/issues/753)--though note that the
plugin will address that bug even without this option or with a value of false ,
albeit in a less performant manner. |