Module

RMP_IncludedCollection

Included collections are non-visible components used to get, save, remove, and update objects in collections.
See:

Methods

# inner aggregateCallback(pipelines, options, callbackSuccess, callbackFailure)

Performs an aggregation operation on the collection.
Parameters:
Name Type Attributes Description
pipelines object Array of pipelines to be executed
options object Options to be used in the call
mode string <optional>
Execution mode of the collection (TEST or LIVE); defaults to the current execution mode of the application
nb number <optional>
Number of objects to be returned (max. 1000); used to paginate the results
first number <optional>
Index of the first object to be returned; used to paginate the results
orderby array <optional>
Array of fields by which to order the results, e.g. ["name", "lastname"]. A $sort pipeline will be appended to the given pipelines.
order array <optional>
Array of orders to be used to sort the results; for each orderby one order is required, e.g. ["asc","desc"]
detailed boolean <optional>
true to get a detailed result (including count, limit, and skip values)
callbackSuccess module:RMP_IncludedCollection~callbackSuccess Callback function called in case of success
callbackFailure module:RMP_IncludedCollection~callbackFailure Callback function called in case of failure
See:

# inner aggregateExt(pipelines, options)

Performs an aggregation operation on the collection.
Parameters:
Name Type Attributes Description
pipelines object Array of pipelines to be executed
options object Options to be used in the call
mode string <optional>
Execution mode of the collection (TEST or LIVE); defaults to the current execution mode of the application
nb number <optional>
Number of objects to be returned (max. 1000); used to paginate the results
first number <optional>
Index of the first object to be returned; used to paginate results
orderby array <optional>
Array of fields by which to order the results, e.g. ["name", "lastname"]. A $sort pipeline will be appended to the given pipelines.
order array <optional>
Array of orders to be used to sort the results; for each orderby one order is required, e.g. ["asc","desc"]
detailed boolean <optional>
true to get a detailed result (including count, limit, and skip values)
onSuccess module:RMP_IncludedCollection~callbackSuccess Callback function called in case of success
onFailure module:RMP_IncludedCollection~callbackFailure Callback function called in case of failure
See:

# inner getName() → {string}

Returns the ID of the collection as a string.
string

# inner getType() → {string}

Returns the type of the component (RMP_IncludedCollection).
string

# inner list(pattern, options, callbackSuccess, messageFailure)

Lists objects matching a given pattern.
Parameters:
Name Type Description
pattern object Pattern to be matched in the collection
options object Options to be used in the call. Same fields as in listExt options, except for the callbacks.
callbackSuccess module:RMP_IncludedCollection~callbackSuccess Callback function called in case of success
messageFailure String Message displayed in case of failure
See:

# inner listCallback(pattern, options, callbackSuccess, callbackFailure)

Lists objects matching a given pattern.
Parameters:
Name Type Description
pattern object Pattern to be matched in the collection
options object Options to be used in the call. Same fields as in listExt options, except for the callbacks.
callbackSuccess module:RMP_IncludedCollection~callbackSuccess Callback function called in case of success
callbackFailure module:RMP_IncludedCollection~callbackFailure Callback function called in case of failure
See:

# inner listExt(pattern, options)

Lists objects matching a given pattern.
Parameters:
Name Type Description
pattern object Pattern to be matched in the collection
options object Options to be used in the call
fields object Array of fields to be retrieved for each object found, e.g. ["name", "lastname"]
mode string Execution mode of the collection (TEST or LIVE); defaults to the current execution mode of the application
nb number Number of objects to be returned (max. 1000); used to paginate the results
first number Index of the first object to be returned; used to paginate the results
orderby array Array of fields by which to order the results, e.g. ["name", "lastname"]
order array Array of orders to be used to sort the results; for each orderby, one order is required, e.g. ["asc","desc"]
detailed boolean true to get a detailed result (including count, limit, and skip values)
onSuccess module:RMP_IncludedCollection~callbackSuccess Callback function called in case of success
onFailure module:RMP_IncludedCollection~callbackFailure Callback function called in case of failure
See:

# inner load(pattern, options, callbackSuccess, messageFailure)

Loads the first object of the collection which matches the given pattern.
Parameters:
Name Type Description
pattern object Object to be retrieved in the collection
options object Options to be used in the call. Same fields as in listExt options, except for the callbacks.
callbackSuccess module:RMP_IncludedCollection~loadCallbackSuccess Callback function called in case of success
messageFailure String Message displayed in case of failure
See:

# inner loadCallback(pattern, options, callbackSuccess, callbackFailure)

Loads the first object of the collection which matches the given pattern.
Parameters:
Name Type Description
pattern object Object to be retrieved in the collection
options object Options to be used in the call. Same fields as in listExt options, except for the callbacks.
callbackSuccess module:RMP_IncludedCollection~loadCallbackSuccess Callback function called in case of success
callbackFailure module:RMP_IncludedCollection~callbackFailure Callback function called in case of failure
See:

# inner loadExt(pattern, options)

Loads the first object of the collection which matches the given pattern.
Parameters:
Name Type Description
pattern object Object to be retrieved in the collection
options object Options to be used in the call. Same fields as in listExt options. options.nb is set to 1, options.first to 0.
See:

# inner remove(pattern, messageSuccess, messageFailure)

Removes objects matching a given pattern from the collection.
Parameters:
Name Type Description
pattern object Pattern to be matched in the collection
messageSuccess String Message displayed in case of success
messageFailure String Message displayed in case of failure
See:

# inner removeCallback(pattern, callbackSuccess, callbackFailure)

Removes objects matching a given pattern from the collection.
Parameters:
Name Type Description
pattern object Pattern to be matched in the collection
callbackSuccess module:RMP_IncludedCollection~countCallbackSuccess Callback function called in case of success
callbackFailure module:RMP_IncludedCollection~callbackFailure Callback function called in case of failure
See:

# inner removeExt(pattern, options)

Removes objects matching a given pattern from the collection.
Parameters:
Name Type Description
pattern object Pattern to be matched in the collection
options object Options to be used in the call
mode string Execution mode of the collection (TEST or LIVE); defaults to the current execution mode of the application
onSuccess module:RMP_IncludedCollection~countCallbackSuccess Callback function called in case of success
onFailure module:RMP_IncludedCollection~callbackFailure Callback function called in case of failure
See:

# inner save(object, messageSuccess, messageFailure)

Saves an object to the collection.
Parameters:
Name Type Description
object object Object to be saved
messageSuccess String Message displayed in case of success
messageFailure String Message displayed in case of failure
See:

# inner saveCallback(object, callbackSuccess, callbackFailure)

Saves an object to the collection.
Parameters:
Name Type Description
object object Object to be saved
callbackSuccess module:RMP_IncludedCollection~saveCallbackSuccess Callback function called in case of success
callbackFailure module:RMP_IncludedCollection~callbackFailure Callback function called in case of failure
See:

# inner saveExt(object, options)

Saves an object to the collection.
Parameters:
Name Type Description
object object Object to be saved
options object Options to be used in the call
mode string Execution mode of the collection (TEST or LIVE); defaults to the current execution mode of the application
onSuccess module:RMP_IncludedCollection~saveCallbackSuccess Callback function called in case of success
onFailure module:RMP_IncludedCollection~callbackFailure Callback function called in case of failure
See:

# inner update(pattern, object, messageSuccess, messageFailure)

Updates the first object of the collection which matches the given pattern.
Parameters:
Name Type Description
pattern object Pattern to be matched in the collection
object object Value to be used to update the matching object
messageSuccess String Message displayed in case of success
messageFailure String Message displayed in case of failure
See:

# inner updateCallback(pattern, object, callbackSuccess, callbackFailure)

Updates the first object of the collection which matches the given pattern.
Parameters:
Name Type Description
pattern object Pattern to be matched in the collection
object object Value to be used to update the matching object
callbackSuccess module:RMP_IncludedCollection~countCallbackSuccess Callback function called in case of success
callbackFailure module:RMP_IncludedCollection~callbackFailure Callback function called in case of failure
See:

# inner updateExt(pattern, object, options)

Updates one or more objects in the collection which match the given pattern.
Parameters:
Name Type Description
pattern object Pattern to be matched in the collection
object object Value to be used to update the matching object or objects
options object Options to be used in the call
multi boolean true to update all matching objects, false to update only the first matching object. If you set true, you have to use $ operators in the object; otherwise the call will silently fail.
mode string Execution mode of the collection (TEST or LIVE); defaults to the current execution mode of the application
onSuccess module:RMP_IncludedCollection~countCallbackSuccess Callback function called in case of success
onFailure module:RMP_IncludedCollection~callbackFailure Callback function called in case of failure
See:

# inner updateMulti(pattern, object, messageSuccess, messageFailure)

Updates multiple objects of the collection.
Parameters:
Name Type Description
pattern object Pattern to be matched in the collection
object object Operations ($ operators) to be executed on the matching objects
messageSuccess String Message displayed in case of success
messageFailure String Message displayed in case of failure
See:

# inner updateMultiCallback(pattern, object, callbackSuccess, callbackFailure)

Updates multiple objects of the collection.
Parameters:
Name Type Description
pattern object Pattern to be matched in the collection
object object Operations ($ operators) to be executed on the matching objects
callbackSuccess module:RMP_IncludedCollection~countCallbackSuccess Callback function called in case of success
callbackFailure module:RMP_IncludedCollection~callbackFailure Callback function called in case of failure
See:

Type Definitions

# callbackFailure(response)

Callback called when a collection operation fails.
Parameters:
Name Type Description
response object Response object
responseJSON object Object
responseJSON.error string Error message sent by the server

# callbackSuccess(response)

Callback called when a collection operation is completed successfully.
Parameters:
Name Type Description
response object If detailed is false the response is an array containing the results. If detailed is true, the response is an object with the following properties:
values array Array containing the objects resulting from the operation
count number Length of the values array
limit number Maximum number of items returned as specified in the pipelines
skip number Rank of the first item returned as specified in the pipelines

# countCallbackSuccess(response)

Callback called when a collection operation succeeds and a count is expected.
Parameters:
Name Type Description
response object Response object
P_count number Number of removed/updated objects

# loadCallbackSuccess(response)

Callback called when a collection operation succeeds and an object is expected.
Parameters:
Name Type Description
response object The object loaded

# saveCallbackSuccess(response)

Callback called when a collection operation succeeds and a saved object is expected.
Parameters:
Name Type Description
response object The new version of the saved object