|
|
@ -97,7 +97,7 @@ module.exports = function(registry) {
|
|
|
|
* @param {Object|Object[]} [data] Optional data argument. Can be either a single model instance or an array of instances.
|
|
|
|
* @param {Object|Object[]} [data] Optional data argument. Can be either a single model instance or an array of instances.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @callback {Function} callback Callback function called with `cb(err, obj)` signature.
|
|
|
|
* @callback {Function} callback Callback function called with `cb(err, obj)` signature.
|
|
|
|
* @param {Error} err Error object; see [Error object](http://docs.strongloop.com/display/LB/Error+object).
|
|
|
|
* @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
|
|
|
|
* @param {Object} models Model instances or null.
|
|
|
|
* @param {Object} models Model instances or null.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
@ -109,7 +109,7 @@ module.exports = function(registry) {
|
|
|
|
* Update or insert a model instance
|
|
|
|
* Update or insert a model instance
|
|
|
|
* @param {Object} data The model instance data to insert.
|
|
|
|
* @param {Object} data The model instance data to insert.
|
|
|
|
* @callback {Function} callback Callback function called with `cb(err, obj)` signature.
|
|
|
|
* @callback {Function} callback Callback function called with `cb(err, obj)` signature.
|
|
|
|
* @param {Error} err Error object; see [Error object](http://docs.strongloop.com/display/LB/Error+object).
|
|
|
|
* @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
|
|
|
|
* @param {Object} model Updated model instance.
|
|
|
|
* @param {Object} model Updated model instance.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
@ -128,10 +128,10 @@ module.exports = function(registry) {
|
|
|
|
* { key: val, key2: {gt: 'val2'}, ...}
|
|
|
|
* { key: val, key2: {gt: 'val2'}, ...}
|
|
|
|
* ```
|
|
|
|
* ```
|
|
|
|
* <br/>see
|
|
|
|
* <br/>see
|
|
|
|
* [Where filter](https://docs.strongloop.com/display/LB/Where+filter#Wherefilter-Whereclauseforothermethods).
|
|
|
|
* [Where filter](http://loopback.io/doc/en/lb2/Where-filter.html#where-clause-for-other-methods).
|
|
|
|
* @param {Object} data The model instance data to insert.
|
|
|
|
* @param {Object} data The model instance data to insert.
|
|
|
|
* @callback {Function} callback Callback function called with `cb(err, obj)` signature.
|
|
|
|
* @callback {Function} callback Callback function called with `cb(err, obj)` signature.
|
|
|
|
* @param {Error} err Error object; see [Error object](http://docs.strongloop.com/display/LB/Error+object).
|
|
|
|
* @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
|
|
|
|
* @param {Object} model Updated model instance.
|
|
|
|
* @param {Object} model Updated model instance.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
@ -148,7 +148,7 @@ module.exports = function(registry) {
|
|
|
|
* @options {Object} [options] Options for replaceOrCreate
|
|
|
|
* @options {Object} [options] Options for replaceOrCreate
|
|
|
|
* @property {Boolean} validate Perform validation before saving. Default is true.
|
|
|
|
* @property {Boolean} validate Perform validation before saving. Default is true.
|
|
|
|
* @callback {Function} callback Callback function called with `cb(err, obj)` signature.
|
|
|
|
* @callback {Function} callback Callback function called with `cb(err, obj)` signature.
|
|
|
|
* @param {Error} err Error object; see [Error object](http://docs.strongloop.com/display/LB/Error+object).
|
|
|
|
* @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
|
|
|
|
* @param {Object} model Replaced model instance.
|
|
|
|
* @param {Object} model Replaced model instance.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
@ -165,24 +165,24 @@ module.exports = function(registry) {
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @options {Object} [filter] Optional Filter object; see below.
|
|
|
|
* @options {Object} [filter] Optional Filter object; see below.
|
|
|
|
* @property {String|Object|Array} fields Identify fields to include in return result.
|
|
|
|
* @property {String|Object|Array} fields Identify fields to include in return result.
|
|
|
|
* <br/>See [Fields filter](http://docs.strongloop.com/display/LB/Fields+filter).
|
|
|
|
* <br/>See [Fields filter](http://loopback.io/doc/en/lb2/Fields-filter.html).
|
|
|
|
* @property {String|Object|Array} include See PersistedModel.include documentation.
|
|
|
|
* @property {String|Object|Array} include See PersistedModel.include documentation.
|
|
|
|
* <br/>See [Include filter](http://docs.strongloop.com/display/LB/Include+filter).
|
|
|
|
* <br/>See [Include filter](http://loopback.io/doc/en/lb2/Include-filter.html).
|
|
|
|
* @property {Number} limit Maximum number of instances to return.
|
|
|
|
* @property {Number} limit Maximum number of instances to return.
|
|
|
|
* <br/>See [Limit filter](http://docs.strongloop.com/display/LB/Limit+filter).
|
|
|
|
* <br/>See [Limit filter](http://loopback.io/doc/en/lb2/Limit-filter.html).
|
|
|
|
* @property {String} order Sort order: either "ASC" for ascending or "DESC" for descending.
|
|
|
|
* @property {String} order Sort order: either "ASC" for ascending or "DESC" for descending.
|
|
|
|
* <br/>See [Order filter](http://docs.strongloop.com/display/LB/Order+filter).
|
|
|
|
* <br/>See [Order filter](http://loopback.io/doc/en/lb2/Order-filter.html).
|
|
|
|
* @property {Number} skip Number of results to skip.
|
|
|
|
* @property {Number} skip Number of results to skip.
|
|
|
|
* <br/>See [Skip filter](http://docs.strongloop.com/display/LB/Skip+filter).
|
|
|
|
* <br/>See [Skip filter](http://loopback.io/doc/en/lb2/Skip-filter.html).
|
|
|
|
* @property {Object} where Where clause, like
|
|
|
|
* @property {Object} where Where clause, like
|
|
|
|
* ```
|
|
|
|
* ```
|
|
|
|
* {where: {key: val, key2: {gt: val2}, ...}}
|
|
|
|
* {where: {key: val, key2: {gt: val2}, ...}}
|
|
|
|
* ```
|
|
|
|
* ```
|
|
|
|
* <br/>See
|
|
|
|
* <br/>See
|
|
|
|
* [Where filter](https://docs.strongloop.com/display/LB/Where+filter#Wherefilter-Whereclauseforqueries).
|
|
|
|
* [Where filter](http://loopback.io/doc/en/lb2/Where-filter.html#where-clause-for-queries).
|
|
|
|
* @param {Object} data Data to insert if object matching the `where` filter is not found.
|
|
|
|
* @param {Object} data Data to insert if object matching the `where` filter is not found.
|
|
|
|
* @callback {Function} callback Callback function called with `cb(err, instance, created)` arguments. Required.
|
|
|
|
* @callback {Function} callback Callback function called with `cb(err, instance, created)` arguments. Required.
|
|
|
|
* @param {Error} err Error object; see [Error object](http://docs.strongloop.com/display/LB/Error+object).
|
|
|
|
* @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
|
|
|
|
* @param {Object} instance Model instance matching the `where` filter, if found.
|
|
|
|
* @param {Object} instance Model instance matching the `where` filter, if found.
|
|
|
|
* @param {Boolean} created True if the instance does not exist and gets created.
|
|
|
|
* @param {Boolean} created True if the instance does not exist and gets created.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -199,7 +199,7 @@ module.exports = function(registry) {
|
|
|
|
* @param {id} id Identifier of object (primary key value).
|
|
|
|
* @param {id} id Identifier of object (primary key value).
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @callback {Function} callback Callback function called with `(err, exists)` arguments. Required.
|
|
|
|
* @callback {Function} callback Callback function called with `(err, exists)` arguments. Required.
|
|
|
|
* @param {Error} err Error object; see [Error object](http://docs.strongloop.com/display/LB/Error+object).
|
|
|
|
* @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
|
|
|
|
* @param {Boolean} exists True if the instance with the specified ID exists; false otherwise.
|
|
|
|
* @param {Boolean} exists True if the instance with the specified ID exists; false otherwise.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
@ -213,11 +213,11 @@ module.exports = function(registry) {
|
|
|
|
* @param {*} id Primary key value
|
|
|
|
* @param {*} id Primary key value
|
|
|
|
* @options {Object} [filter] Optional Filter JSON object; see below.
|
|
|
|
* @options {Object} [filter] Optional Filter JSON object; see below.
|
|
|
|
* @property {String|Object|Array} fields Identify fields to include in return result.
|
|
|
|
* @property {String|Object|Array} fields Identify fields to include in return result.
|
|
|
|
* <br/>See [Fields filter](http://docs.strongloop.com/display/LB/Fields+filter).
|
|
|
|
* <br/>See [Fields filter](http://loopback.io/doc/en/lb2/Fields-filter.html).
|
|
|
|
* @property {String|Object|Array} include See PersistedModel.include documentation.
|
|
|
|
* @property {String|Object|Array} include See PersistedModel.include documentation.
|
|
|
|
* <br/>See [Include filter](http://docs.strongloop.com/display/LB/Include+filter).
|
|
|
|
* <br/>See [Include filter](http://loopback.io/doc/en/lb2/Include-filter.html).
|
|
|
|
* @callback {Function} callback Callback function called with `(err, instance)` arguments. Required.
|
|
|
|
* @callback {Function} callback Callback function called with `(err, instance)` arguments. Required.
|
|
|
|
* @param {Error} err Error object; see [Error object](http://docs.strongloop.com/display/LB/Error+object).
|
|
|
|
* @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
|
|
|
|
* @param {Object} instance Model instance matching the specified ID or null if no instance matches.
|
|
|
|
* @param {Object} instance Model instance matching the specified ID or null if no instance matches.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
@ -227,28 +227,28 @@ module.exports = function(registry) {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Find all model instances that match `filter` specification.
|
|
|
|
* Find all model instances that match `filter` specification.
|
|
|
|
* See [Querying models](http://docs.strongloop.com/display/LB/Querying+models).
|
|
|
|
* See [Querying models](http://loopback.io/doc/en/lb2/Querying-data.html).
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @options {Object} [filter] Optional Filter JSON object; see below.
|
|
|
|
* @options {Object} [filter] Optional Filter JSON object; see below.
|
|
|
|
* @property {String|Object|Array} fields Identify fields to include in return result.
|
|
|
|
* @property {String|Object|Array} fields Identify fields to include in return result.
|
|
|
|
* <br/>See [Fields filter](http://docs.strongloop.com/display/LB/Fields+filter).
|
|
|
|
* <br/>See [Fields filter](http://loopback.io/doc/en/lb2/Fields-filter.html).
|
|
|
|
* @property {String|Object|Array} include See PersistedModel.include documentation.
|
|
|
|
* @property {String|Object|Array} include See PersistedModel.include documentation.
|
|
|
|
* <br/>See [Include filter](http://docs.strongloop.com/display/LB/Include+filter).
|
|
|
|
* <br/>See [Include filter](http://loopback.io/doc/en/lb2/Include-filter.html).
|
|
|
|
* @property {Number} limit Maximum number of instances to return.
|
|
|
|
* @property {Number} limit Maximum number of instances to return.
|
|
|
|
* <br/>See [Limit filter](http://docs.strongloop.com/display/LB/Limit+filter).
|
|
|
|
* <br/>See [Limit filter](http://loopback.io/doc/en/lb2/Limit-filter.html).
|
|
|
|
* @property {String} order Sort order: either "ASC" for ascending or "DESC" for descending.
|
|
|
|
* @property {String} order Sort order: either "ASC" for ascending or "DESC" for descending.
|
|
|
|
* <br/>See [Order filter](http://docs.strongloop.com/display/LB/Order+filter).
|
|
|
|
* <br/>See [Order filter](http://loopback.io/doc/en/lb2/Order-filter.html).
|
|
|
|
* @property {Number} skip Number of results to skip.
|
|
|
|
* @property {Number} skip Number of results to skip.
|
|
|
|
* <br/>See [Skip filter](http://docs.strongloop.com/display/LB/Skip+filter).
|
|
|
|
* <br/>See [Skip filter](http://loopback.io/doc/en/lb2/Skip-filter.html).
|
|
|
|
* @property {Object} where Where clause, like
|
|
|
|
* @property {Object} where Where clause, like
|
|
|
|
* ```
|
|
|
|
* ```
|
|
|
|
* { where: { key: val, key2: {gt: 'val2'}, ...} }
|
|
|
|
* { where: { key: val, key2: {gt: 'val2'}, ...} }
|
|
|
|
* ```
|
|
|
|
* ```
|
|
|
|
* <br/>See
|
|
|
|
* <br/>See
|
|
|
|
* [Where filter](https://docs.strongloop.com/display/LB/Where+filter#Wherefilter-Whereclauseforqueries).
|
|
|
|
* [Where filter](http://loopback.io/doc/en/lb2/Where-filter.html#where-clause-for-queries).
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @callback {Function} callback Callback function called with `(err, returned-instances)` arguments. Required.
|
|
|
|
* @callback {Function} callback Callback function called with `(err, returned-instances)` arguments. Required.
|
|
|
|
* @param {Error} err Error object; see [Error object](http://docs.strongloop.com/display/LB/Error+object).
|
|
|
|
* @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
|
|
|
|
* @param {Array} models Model instances matching the filter, or null if none found.
|
|
|
|
* @param {Array} models Model instances matching the filter, or null if none found.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
@ -263,22 +263,22 @@ module.exports = function(registry) {
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @options {Object} [filter] Optional Filter JSON object; see below.
|
|
|
|
* @options {Object} [filter] Optional Filter JSON object; see below.
|
|
|
|
* @property {String|Object|Array} fields Identify fields to include in return result.
|
|
|
|
* @property {String|Object|Array} fields Identify fields to include in return result.
|
|
|
|
* <br/>See [Fields filter](http://docs.strongloop.com/display/LB/Fields+filter).
|
|
|
|
* <br/>See [Fields filter](http://loopback.io/doc/en/lb2/Fields-filter.html).
|
|
|
|
* @property {String|Object|Array} include See PersistedModel.include documentation.
|
|
|
|
* @property {String|Object|Array} include See PersistedModel.include documentation.
|
|
|
|
* <br/>See [Include filter](http://docs.strongloop.com/display/LB/Include+filter).
|
|
|
|
* <br/>See [Include filter](http://loopback.io/doc/en/lb2/Include-filter.html).
|
|
|
|
* @property {String} order Sort order: either "ASC" for ascending or "DESC" for descending.
|
|
|
|
* @property {String} order Sort order: either "ASC" for ascending or "DESC" for descending.
|
|
|
|
* <br/>See [Order filter](http://docs.strongloop.com/display/LB/Order+filter).
|
|
|
|
* <br/>See [Order filter](http://loopback.io/doc/en/lb2/Order-filter.html).
|
|
|
|
* @property {Number} skip Number of results to skip.
|
|
|
|
* @property {Number} skip Number of results to skip.
|
|
|
|
* <br/>See [Skip filter](http://docs.strongloop.com/display/LB/Skip+filter).
|
|
|
|
* <br/>See [Skip filter](http://loopback.io/doc/en/lb2/Skip-filter.html).
|
|
|
|
* @property {Object} where Where clause, like
|
|
|
|
* @property {Object} where Where clause, like
|
|
|
|
* ```
|
|
|
|
* ```
|
|
|
|
* {where: { key: val, key2: {gt: 'val2'}, ...} }
|
|
|
|
* {where: { key: val, key2: {gt: 'val2'}, ...} }
|
|
|
|
* ```
|
|
|
|
* ```
|
|
|
|
* <br/>See
|
|
|
|
* <br/>See
|
|
|
|
* [Where filter](https://docs.strongloop.com/display/LB/Where+filter#Wherefilter-Whereclauseforqueries).
|
|
|
|
* [Where filter](http://loopback.io/doc/en/lb2/Where-filter.html#where-clause-for-queries).
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @callback {Function} callback Callback function called with `(err, returned-instance)` arguments. Required.
|
|
|
|
* @callback {Function} callback Callback function called with `(err, returned-instance)` arguments. Required.
|
|
|
|
* @param {Error} err Error object; see [Error object](http://docs.strongloop.com/display/LB/Error+object).
|
|
|
|
* @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
|
|
|
|
* @param {Array} model First model instance that matches the filter or null if none found.
|
|
|
|
* @param {Array} model First model instance that matches the filter or null if none found.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
@ -294,10 +294,10 @@ module.exports = function(registry) {
|
|
|
|
* {key: val, key2: {gt: 'val2'}, ...}
|
|
|
|
* {key: val, key2: {gt: 'val2'}, ...}
|
|
|
|
* ```
|
|
|
|
* ```
|
|
|
|
* <br/>See
|
|
|
|
* <br/>See
|
|
|
|
* [Where filter](https://docs.strongloop.com/display/LB/Where+filter#Wherefilter-Whereclauseforothermethods).
|
|
|
|
* [Where filter](http://loopback.io/doc/en/lb2/Where-filter.html#where-clause-for-other-methods).
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @callback {Function} callback Optional callback function called with `(err, info)` arguments.
|
|
|
|
* @callback {Function} callback Optional callback function called with `(err, info)` arguments.
|
|
|
|
* @param {Error} err Error object; see [Error object](http://docs.strongloop.com/display/LB/Error+object).
|
|
|
|
* @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
|
|
|
|
* @param {Object} info Additional information about the command outcome.
|
|
|
|
* @param {Object} info Additional information about the command outcome.
|
|
|
|
* @param {Number} info.count Number of instances (rows, documents) destroyed.
|
|
|
|
* @param {Number} info.count Number of instances (rows, documents) destroyed.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -332,11 +332,11 @@ module.exports = function(registry) {
|
|
|
|
* { key: val, key2: {gt: 'val2'}, ...}
|
|
|
|
* { key: val, key2: {gt: 'val2'}, ...}
|
|
|
|
* ```
|
|
|
|
* ```
|
|
|
|
* <br/>see
|
|
|
|
* <br/>see
|
|
|
|
* [Where filter](https://docs.strongloop.com/display/LB/Where+filter#Wherefilter-Whereclauseforothermethods).
|
|
|
|
* [Where filter](http://loopback.io/doc/en/lb2/Where-filter.html#where-clause-for-other-methods).
|
|
|
|
* @param {Object} data Object containing data to replace matching instances, if any.
|
|
|
|
* @param {Object} data Object containing data to replace matching instances, if any.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @callback {Function} callback Callback function called with `(err, info)` arguments. Required.
|
|
|
|
* @callback {Function} callback Callback function called with `(err, info)` arguments. Required.
|
|
|
|
* @param {Error} err Error object; see [Error object](http://docs.strongloop.com/display/LB/Error+object).
|
|
|
|
* @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
|
|
|
|
* @param {Object} info Additional information about the command outcome.
|
|
|
|
* @param {Object} info Additional information about the command outcome.
|
|
|
|
* @param {Number} info.count Number of instances (rows, documents) updated.
|
|
|
|
* @param {Number} info.count Number of instances (rows, documents) updated.
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -354,7 +354,7 @@ module.exports = function(registry) {
|
|
|
|
* Destroy model instance with the specified ID.
|
|
|
|
* Destroy model instance with the specified ID.
|
|
|
|
* @param {*} id The ID value of model instance to delete.
|
|
|
|
* @param {*} id The ID value of model instance to delete.
|
|
|
|
* @callback {Function} callback Callback function called with `(err)` arguments. Required.
|
|
|
|
* @callback {Function} callback Callback function called with `(err)` arguments. Required.
|
|
|
|
* @param {Error} err Error object; see [Error object](http://docs.strongloop.com/display/LB/Error+object).
|
|
|
|
* @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
PersistedModel.destroyById = function deleteById(id, cb) {
|
|
|
|
PersistedModel.destroyById = function deleteById(id, cb) {
|
|
|
|
throwNotAttached(this.modelName, 'deleteById');
|
|
|
|
throwNotAttached(this.modelName, 'deleteById');
|
|
|
@ -377,9 +377,9 @@ module.exports = function(registry) {
|
|
|
|
* { key: val, key2: {gt: 'val2'}, ...}
|
|
|
|
* { key: val, key2: {gt: 'val2'}, ...}
|
|
|
|
* ```
|
|
|
|
* ```
|
|
|
|
* <br/>See
|
|
|
|
* <br/>See
|
|
|
|
* [Where filter](https://docs.strongloop.com/display/LB/Where+filter#Wherefilter-Whereclauseforothermethods).
|
|
|
|
* [Where filter](http://loopback.io/doc/en/lb2/Where-filter.html#where-clause-for-other-methods).
|
|
|
|
* @callback {Function} callback Callback function called with `(err, count)` arguments. Required.
|
|
|
|
* @callback {Function} callback Callback function called with `(err, count)` arguments. Required.
|
|
|
|
* @param {Error} err Error object; see [Error object](http://docs.strongloop.com/display/LB/Error+object).
|
|
|
|
* @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
|
|
|
|
* @param {Number} count Number of instances updated.
|
|
|
|
* @param {Number} count Number of instances updated.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
@ -395,7 +395,7 @@ module.exports = function(registry) {
|
|
|
|
* @property {Boolean} throws If true, throw a validation error; WARNING: This can crash Node.
|
|
|
|
* @property {Boolean} throws If true, throw a validation error; WARNING: This can crash Node.
|
|
|
|
* If false, report the error via callback. Default is false.
|
|
|
|
* If false, report the error via callback. Default is false.
|
|
|
|
* @callback {Function} callback Optional callback function called with `(err, obj)` arguments.
|
|
|
|
* @callback {Function} callback Optional callback function called with `(err, obj)` arguments.
|
|
|
|
* @param {Error} err Error object; see [Error object](http://docs.strongloop.com/display/LB/Error+object).
|
|
|
|
* @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
|
|
|
|
* @param {Object} instance Model instance saved or created.
|
|
|
|
* @param {Object} instance Model instance saved or created.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
@ -501,7 +501,7 @@ module.exports = function(registry) {
|
|
|
|
* @param {String} name Name of property.
|
|
|
|
* @param {String} name Name of property.
|
|
|
|
* @param {Mixed} value Value of property.
|
|
|
|
* @param {Mixed} value Value of property.
|
|
|
|
* @callback {Function} callback Callback function called with `(err, instance)` arguments. Required.
|
|
|
|
* @callback {Function} callback Callback function called with `(err, instance)` arguments. Required.
|
|
|
|
* @param {Error} err Error object; see [Error object](http://docs.strongloop.com/display/LB/Error+object).
|
|
|
|
* @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
|
|
|
|
* @param {Object} instance Updated instance.
|
|
|
|
* @param {Object} instance Updated instance.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
@ -515,7 +515,7 @@ module.exports = function(registry) {
|
|
|
|
* Triggers: `validation`, `save` and `update` hooks
|
|
|
|
* Triggers: `validation`, `save` and `update` hooks
|
|
|
|
* @param {Object} data Data to update.
|
|
|
|
* @param {Object} data Data to update.
|
|
|
|
* @callback {Function} callback Callback function called with `(err, instance)` arguments. Required.
|
|
|
|
* @callback {Function} callback Callback function called with `(err, instance)` arguments. Required.
|
|
|
|
* @param {Error} err Error object; see [Error object](http://docs.strongloop.com/display/LB/Error+object).
|
|
|
|
* @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
|
|
|
|
* @param {Object} instance Updated instance.
|
|
|
|
* @param {Object} instance Updated instance.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
@ -532,7 +532,7 @@ module.exports = function(registry) {
|
|
|
|
* @options {Object} [options] Options for replace
|
|
|
|
* @options {Object} [options] Options for replace
|
|
|
|
* @property {Boolean} validate Perform validation before saving. Default is true.
|
|
|
|
* @property {Boolean} validate Perform validation before saving. Default is true.
|
|
|
|
* @callback {Function} callback Callback function called with `(err, instance)` arguments.
|
|
|
|
* @callback {Function} callback Callback function called with `(err, instance)` arguments.
|
|
|
|
* @param {Error} err Error object; see [Error object](http://docs.strongloop.com/display/LB/Error+object).
|
|
|
|
* @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
|
|
|
|
* @param {Object} instance Replaced instance.
|
|
|
|
* @param {Object} instance Replaced instance.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
@ -550,7 +550,7 @@ module.exports = function(registry) {
|
|
|
|
* @options {Object} [options] Options for replace
|
|
|
|
* @options {Object} [options] Options for replace
|
|
|
|
* @property {Boolean} validate Perform validation before saving. Default is true.
|
|
|
|
* @property {Boolean} validate Perform validation before saving. Default is true.
|
|
|
|
* @callback {Function} callback Callback function called with `(err, instance)` arguments.
|
|
|
|
* @callback {Function} callback Callback function called with `(err, instance)` arguments.
|
|
|
|
* @param {Error} err Error object; see [Error object](http://docs.strongloop.com/display/LB/Error+object).
|
|
|
|
* @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
|
|
|
|
* @param {Object} instance Replaced instance.
|
|
|
|
* @param {Object} instance Replaced instance.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
@ -561,7 +561,7 @@ module.exports = function(registry) {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Reload object from persistence. Requires `id` member of `object` to be able to call `find`.
|
|
|
|
* Reload object from persistence. Requires `id` member of `object` to be able to call `find`.
|
|
|
|
* @callback {Function} callback Callback function called with `(err, instance)` arguments. Required.
|
|
|
|
* @callback {Function} callback Callback function called with `(err, instance)` arguments. Required.
|
|
|
|
* @param {Error} err Error object; see [Error object](http://docs.strongloop.com/display/LB/Error+object).
|
|
|
|
* @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
|
|
|
|
* @param {Object} instance Model instance.
|
|
|
|
* @param {Object} instance Model instance.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
@ -980,7 +980,7 @@ module.exports = function(registry) {
|
|
|
|
* @param {Number} since Find deltas since this checkpoint.
|
|
|
|
* @param {Number} since Find deltas since this checkpoint.
|
|
|
|
* @param {Array} remoteChanges An array of change objects.
|
|
|
|
* @param {Array} remoteChanges An array of change objects.
|
|
|
|
* @callback {Function} callback Callback function called with `(err, result)` arguments. Required.
|
|
|
|
* @callback {Function} callback Callback function called with `(err, result)` arguments. Required.
|
|
|
|
* @param {Error} err Error object; see [Error object](http://docs.strongloop.com/display/LB/Error+object).
|
|
|
|
* @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
|
|
|
|
* @param {Object} result Object with `deltas` and `conflicts` properties; see [Change.diff()](#change-diff) for details.
|
|
|
|
* @param {Object} result Object with `deltas` and `conflicts` properties; see [Change.diff()](#change-diff) for details.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
@ -995,7 +995,7 @@ module.exports = function(registry) {
|
|
|
|
* @param {Number} since Return only changes since this checkpoint.
|
|
|
|
* @param {Number} since Return only changes since this checkpoint.
|
|
|
|
* @param {Object} filter Include only changes that match this filter, the same as for [#persistedmodel-find](find()).
|
|
|
|
* @param {Object} filter Include only changes that match this filter, the same as for [#persistedmodel-find](find()).
|
|
|
|
* @callback {Function} callback Callback function called with `(err, changes)` arguments. Required.
|
|
|
|
* @callback {Function} callback Callback function called with `(err, changes)` arguments. Required.
|
|
|
|
* @param {Error} err Error object; see [Error object](http://docs.strongloop.com/display/LB/Error+object).
|
|
|
|
* @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
|
|
|
|
* @param {Array} changes An array of [Change](#change) objects.
|
|
|
|
* @param {Array} changes An array of [Change](#change) objects.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
@ -1059,7 +1059,7 @@ module.exports = function(registry) {
|
|
|
|
* Get the current checkpoint ID.
|
|
|
|
* Get the current checkpoint ID.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @callback {Function} callback Callback function called with `(err, currentCheckpointId)` arguments. Required.
|
|
|
|
* @callback {Function} callback Callback function called with `(err, currentCheckpointId)` arguments. Required.
|
|
|
|
* @param {Error} err Error object; see [Error object](http://docs.strongloop.com/display/LB/Error+object).
|
|
|
|
* @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
|
|
|
|
* @param {Number} currentCheckpointId Current checkpoint ID.
|
|
|
|
* @param {Number} currentCheckpointId Current checkpoint ID.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
@ -1076,7 +1076,7 @@ module.exports = function(registry) {
|
|
|
|
* @param {Object} [options]
|
|
|
|
* @param {Object} [options]
|
|
|
|
* @param {Object} [options.filter] Replicate models that match this filter
|
|
|
|
* @param {Object} [options.filter] Replicate models that match this filter
|
|
|
|
* @callback {Function} [callback] Callback function called with `(err, conflicts)` arguments.
|
|
|
|
* @callback {Function} [callback] Callback function called with `(err, conflicts)` arguments.
|
|
|
|
* @param {Error} err Error object; see [Error object](http://docs.strongloop.com/display/LB/Error+object).
|
|
|
|
* @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
|
|
|
|
* @param {Conflict[]} conflicts A list of changes that could not be replicated due to conflicts.
|
|
|
|
* @param {Conflict[]} conflicts A list of changes that could not be replicated due to conflicts.
|
|
|
|
* @param {Object} checkpoints The new checkpoints to use as the "since"
|
|
|
|
* @param {Object} checkpoints The new checkpoints to use as the "since"
|
|
|
|
* argument for the next replication.
|
|
|
|
* argument for the next replication.
|
|
|
@ -1543,7 +1543,7 @@ module.exports = function(registry) {
|
|
|
|
* Get the source identifier for this model or dataSource.
|
|
|
|
* Get the source identifier for this model or dataSource.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @callback {Function} callback Callback function called with `(err, id)` arguments.
|
|
|
|
* @callback {Function} callback Callback function called with `(err, id)` arguments.
|
|
|
|
* @param {Error} err Error object; see [Error object](http://docs.strongloop.com/display/LB/Error+object).
|
|
|
|
* @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
|
|
|
|
* @param {String} sourceId Source identifier for the model or dataSource.
|
|
|
|
* @param {String} sourceId Source identifier for the model or dataSource.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
@ -1702,7 +1702,7 @@ module.exports = function(registry) {
|
|
|
|
* Handle a change error. Override this method in a subclassing model to customize
|
|
|
|
* Handle a change error. Override this method in a subclassing model to customize
|
|
|
|
* change error handling.
|
|
|
|
* change error handling.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param {Error} err Error object; see [Error object](http://docs.strongloop.com/display/LB/Error+object).
|
|
|
|
* @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
PersistedModel.handleChangeError = function(err, operationName) {
|
|
|
|
PersistedModel.handleChangeError = function(err, operationName) {
|
|
|
@ -1744,7 +1744,7 @@ module.exports = function(registry) {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Create a change stream. [See here for more info](http://docs.strongloop.com/pages/viewpage.action?pageId=6721710)
|
|
|
|
* Create a change stream. [See here for more info](http://loopback.io/doc/en/lb2/Realtime-server-sent-events.html)
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param {Object} options
|
|
|
|
* @param {Object} options
|
|
|
|
* @param {Object} options.where Only changes to models matching this where filter will be included in the `ChangeStream`.
|
|
|
|
* @param {Object} options.where Only changes to models matching this where filter will be included in the `ChangeStream`.
|
|
|
|