carbond.mongodb.MongoDBCollection

extends Collection

A concrete implementation of Collection that supports MongoDB

Static Properties

ALL_METHODS
Object
Inherited fromCollection
Required
Description A list of all HTTP methods recognized by carbond

Instance Properties

ALL_COLLECTION_OPERATIONS
array
Inherited fromCollection
(read-only)
Description The list of valid collection operations
allowUnauthenticated
string[]
Inherited fromCollection
Required
Description Skip authentication for the HTTP methods listed on this endpoint
collection
Collection
(read-only)
Description The collection object for the collection this instance is accessing
COLLECTION_QUERY_OPERATIONS
Array
(read-only)
Description The list of operations that support queries
collectionName
string
Required
Description The database collection name
db
DB
(read-only)
Description The database object for the database that houses the collection this instance is accessing
dbName
string
Default undefined
Description The database name. Note, this is only needed if the Service instance connects to multiple databases
defaultErrorSchema
Object
Inherited fromCollection
(read-only)
Description This is the default error body schema.
defaultIdHeaderName
string
Inherited fromCollection
(read-only)
Description The default ID header name
defaultIdParameter
string
Inherited fromCollection
(read-only)
Description The default ID name of objects in this collection
defaultIdPathParameter
string
Inherited fromCollection
(read-only)
Description The default path parameter name representing the ID for an object in this collection
defaultSchema
Object
(read-only)
Description This is the default schema used to validate all objects in this collection. If a schema is not specified explicitly, this schema will be used.
description
string
Inherited fromCollection
Default undefined
Description A brief description of what this endpoint does. This will be displayed in any generated documentation.
enabled
Object
Inherited fromCollection
Default {'*': false}
Description Control which collection level operations
endpoints
Object.<string, carbond.Endpoint>
Inherited fromCollection
Required
Description The endpoints that sit below this endpoint in the tree. URL paths to each endpoint are built during a depth first traversal of the tree on initialization using the property names defined on this Object.
example
Object
Inherited fromCollection
Default undefined
Description An example object for this collection
findConfig
Object
Inherited fromCollection
Default o({}, carbond.collections.FindConfigClass)
Description The config used to govern the behavior of the find operation
FindConfigClass
(read-only)
Description The config class used to instantiate the find operation config
findObjectConfig
Object
Inherited fromCollection
Default o({}, carbond.collections.FindObjectConfigClass)
Description The config used to govern the behavior of the findObject operation
FindObjectConfigClass
(read-only)
Description The config class used to instantiate the findObject operation config
idGenerator
Object
Inherited fromCollection
Default undefined
Description An object with the method “generateId” that will be called to populate ID if present and when appropriate (e.g. insert)
idHeaderName
string
Inherited fromCollection
Default defaultIdHeaderName
Description The header name which should contain the EJSON serialized ID
idParameterName
string
Default '_id'
Description The ID parameter name
idPathParameterName
string
Inherited fromCollection
Default defaultIdParameter
Description The PATH_ID parameter name (e.g., /collection/:PATH_ID)
insertConfig
Object
Inherited fromCollection
Default o({}, carbond.collections.InsertConfigClass)
Description The config used to govern the behavior of the insert operation
InsertConfigClass
(read-only)
Description The config class used to instantiate the insert operation config
insertObjectConfig
Object
Inherited fromCollection
Default o({}, carbond.collections.InsertObjectConfigClass)
Description The config used to govern the behavior of the insertObject operation
InsertObjectConfigClass
(read-only)
Description The config class used to instantiate the insertObject operation config
noDocument
boolean
Inherited fromCollection
Default false
Description Controls whether documentation for this endpoint is included in generated static documentation
parameters
Object.<string, carbond.OperationParameter>
Inherited fromCollection
Required
Description Operation parameter definitions that apply to all operations supported by this endpoint. Note, these will be merged with any parameter definitions on the operations themselves and their parsed values will be passed to the handler via req.parameters[<parameter name>].
parent
Inherited fromCollection
(read-only)
Description The parent endpoint for this endpoint in the endpoint tree
path
string
Inherited fromCollection
(read-only)
Description The URI path that routes to this endpoint. This is built during service initialization and will overwrite any value specified on instantiation.
querySchema
Object
Default undefined
Description The JSON schema used to validate the query spec for query enabled operations (e.g., find)
removeConfig
Object
Inherited fromCollection
Default o({}, carbond.collections.RemoveConfigClass)
Description The config used to govern the behavior of the remove operation
RemoveConfigClass
(read-only)
Description The config class used to instantiate the remove operation config
removeObjectConfig
Object
Inherited fromCollection
Default o({}, carbond.collections.RemoveObjectConfigClass)
Description The config used to govern the behavior of the removeObject operation
RemoveObjectConfigClass
RemoveObjectConfig
(read-only)
Description The config class used to instantiate the removeObject operation config
saveConfig
Object
Inherited fromCollection
Default o({}, carbond.collections.SaveConfigClass)
Description The config used to govern the behavior of the save operation
MongoDBSaveConfigClass
(read-only)
Description The config class used to instantiate the save operation config
saveObjectConfig
Object
Inherited fromCollection
Default o({}, carbond.collections.SaveObjectConfigClass)
Description The config used to govern the behavior of the saveObject operation
SaveObjectConfigClass
(read-only)
Description The config class used to instantiate the saveObject operation config
schema
Object
Inherited fromCollection
Default defaultSchema
Description The schema used to validate objects in this collection
service
Inherited fromCollection
(read-only)
Deprecated
Description The root service object managing the endpoint tree. Getting a reference to this object is sometimes necessary or just convenient (i.e., HTTP error classes can be accessed via errors).
supportsFind
boolean
Inherited fromCollection
Required
Description Whether or not the find operation is supported
supportsFindObject
boolean
Inherited fromCollection
Required
Description Whether or not the findObject operation is supported
supportsInsert
boolean
Inherited fromCollection
Required
Description Whether or not the insert operation is supported
supportsInsertObject
boolean
Inherited fromCollection
Required
Description Whether or not the insertObject operation is supported
supportsRemove
boolean
Inherited fromCollection
Required
Description Whether or not the remove operation is supported
supportsRemoveObject
boolean
Inherited fromCollection
Required
Description Whether or not the removeObject operation is supported
supportsSave
boolean
Inherited fromCollection
Required
Description Whether or not the save operation is supported
supportsSaveObject
boolean
Inherited fromCollection
Required
Description Whether or not the saveObject operation is supported
supportsUpdate
boolean
Inherited fromCollection
Required
Description Whether or not the update operation is supported
supportsUpdateObject
boolean
Inherited fromCollection
Required
Description Whether or not the updateObject operation is supported
updateConfig
Object
Inherited fromCollection
Default o({}, carbond.collections.UpdateConfigClass)
Description The config used to govern the behavior of the update operation
UpdateConfigClass
(read-only)
Description The config class used to instantiate the update operation config
updateObjectConfig
Object
Inherited fromCollection
Default o({}, carbond.collections.UpdateObjectConfigClass)
Description The config used to govern the behavior of the updateObject operation
UpdateObjectConfigClass
(read-only)
Description The config class used to instantiate the updateObject operation config
updateObjectSchema
Object
Default undefined
Description The JSON schema used to validate the update spec passed to updateObject
updateSchema
Object
Default undefined
Description The JSON schema used to validate the update spec passed to update
validateOutput
boolean
Inherited fromCollection
Default true
Description Controls whether or not response bodies are validated using the response schema corresponding to the current response code

Methods

configureFindObjectOperation
Inherited fromCollection
Return type ConfigureOperationResult
Description Update the operation config using collection level config (e.g., schema) and build operation responses. In general, this method should not need to be overridden or extended. Instead, customization should be driven by the operation config and the pre/post handler methods.
configureFindOperation
Inherited fromCollection
Return type ConfigureOperationResult
Description Update the operation config using collection level config (e.g., schema) and build operation responses. In general, this method should not need to be overridden or extended. Instead, customization should be driven by the operation config and the pre/post handler methods.
configureInsertObjectOperation
Inherited fromCollection
Return type ConfigureOperationResult
Description Update the operation config using collection level config (e.g., schema) and build operation responses. In general, this method should not need to be overridden or extended. Instead, customization should be driven by the operation config and the pre/post handler methods.
configureInsertOperation
Inherited fromCollection
Return type ConfigureOperationResult
Description Update the operation config using collection level config (e.g., schema) and build operation responses. In general, this method should not need to be overridden or extended. Instead, customization should be driven by the operation config and the pre/post handler methods.
configureRemoveObjectOperation
Inherited fromCollection
Return type ConfigureOperationResult
Description Update the operation config using collection level config (e.g., schema) and build operation responses. In general, this method should not need to be overridden or extended. Instead, customization should be driven by the operation config and the pre/post handler methods.
configureRemoveOperation
Inherited fromCollection
Return type ConfigureOperationResult
Description Update the operation config using collection level config (e.g., schema) and build operation responses. In general, this method should not need to be overridden or extended. Instead, customization should be driven by the operation config and the pre/post handler methods.
configureSaveObjectOperation
Inherited fromCollection
Return type ConfigureOperationResult
Description Update the operation config using collection level config (e.g., schema) and build operation responses. In general, this method should not need to be overridden or extended. Instead, customization should be driven by the operation config and the pre/post handler methods.
configureSaveOperation
Inherited fromCollection
Return type ConfigureOperationResult
Description Update the operation config using collection level config (e.g., schema) and build operation responses. In general, this method should not need to be overridden or extended. Instead, customization should be driven by the operation config and the pre/post handler methods.
configureUpdateObjectOperation
Inherited fromCollection
Return type ConfigureOperationResult
Description Update the operation config using collection level config (e.g., schema) and build operation responses. In general, this method should not need to be overridden or extended. Instead, customization should be driven by the operation config and the pre/post handler methods.
configureUpdateOperation
Inherited fromCollection
Return type ConfigureOperationResult
Description Update the operation config using collection level config (e.g., schema) and build operation responses. In general, this method should not need to be overridden or extended. Instead, customization should be driven by the operation config and the pre/post handler methods.
find  
Arguments
  • options (Object) – The operation parameters (see: FindConfigClass)
  • context (Object) – A free form object to pass data between hook and handler methods
Throws CollectionError
Returns A list of objects
Return type Object[]
Description Retrieve objects from a collection
findObject  
Arguments
  • id (string) – The object id
  • options (Object) – The operation parameters (see: FindObjectConfigClass)
  • context (Object) – A free form object to pass data between hook and handler methods
Throws CollectionError
Returns The found object or null
Return type Object | null
Description Retrieve a single object from a collection
getOperation
Inherited fromCollection
Arguments
  • method (string) – The HTTP method corresponding to the operation to retrieve
Return type Operation
Description Retrieves the operation instance corresponding to the passed HTTP method
getOperationConfig
Inherited fromCollection
Arguments
  • op (string) – The operation name (e.g., “insert”)
Return type CollectionOperationConfig
Description Get the config for an operation by name
getOperationConfigFieldName
Inherited fromCollection
Arguments
  • op (string) – The operation name (e.g., “insert”)
Return type string
Description Get the property name for an operation config by name
getService
Inherited fromCollection
Return type Service
Description Returns the root Service instance (note, this is preferred over accessing the service property itself)
insert  
Arguments
  • objects (Array) – An array of objects to insert
  • options (Object) – The operation parameters (see: InsertConfigClass)
  • context (Object) – A free form object to pass data between hook and handler methods
Throws CollectionError
Returns The list of inserted objects
Return type Object[]
Description Bulk insert objects into a collection
insertObject  
Arguments
  • object (Object) – An object to insert
  • options (Object) – The operation parameters (see: InsertObjectConfigClass)
  • context (Object) – A free form object to pass data between hook and handler methods
Throws CollectionError
Returns The inserted object
Return type Object
Description Insert a single object into a collection
isOperationAuthorized
Inherited fromCollection
Arguments
  • method (string) – The HTTP method corresponding to the operation that we are attempting to authorize
  • user (Object) – The user object
  • req (Request) – The request object
Returns Whether of not the operation is authorized
Return type boolean
Description Tests whether an operation is authorized given a user (as returned by the root authenticator) and any Acl that may apply to this endpoint
operations
Inherited fromCollection
Return type Operation[]
Description Gathers all operations defined on this endpoint
options
Inherited fromCollection
Arguments
  • req (Request) – The request object
  • res (Response) – The response object
Return type undefined
Description Implements the OPTIONS method handler
postFind
Inherited fromCollection
Arguments
  • result (Object[]) – The found object(s)
  • options (Object) – The operation handler options
  • context (Object) – A free form object to pass data between hook and handler methods
Return type Object[]
Description Update or transform the operation result before passing it back up to the HTTP layer
postFindObject
Inherited fromCollection
Arguments
  • result (Object | null) – The found object
  • id (string) – The object id
  • options (Object) – The operation handler options
  • context (Object) – A free form object to pass data between hook and handler methods
Return type Object | null
Description Update or transform the operation result before passing it back up to the HTTP layer
postFindObjectOperation
Inherited fromCollection
Arguments
  • result (Object | null) – The found object
  • config (findObjectConfig) – The find object operation config
  • req (Request) – The request object
  • res (Response) – The response object
  • context (Object) – A free form object to pass data between hook and handler methods
Returns Returns the found object
Return type Object | null
Description Update the HTTP response to reflect the result of the operation
postFindOperation
Inherited fromCollection
Arguments
  • result (Object[]) – The found objects
  • config (findConfig) – The find operation config
  • req (Request) – The request object
  • res (Response) – The response object
  • context (Object) – A free form object to pass data between hook and handler methods
Returns Returns the found objects
Return type Object[]
Description Update the HTTP response to reflect the result of the operation
postInsert
Inherited fromCollection
Arguments
  • result (Object[]) – The inserted object(s)
  • objects (Object[]) – The object(s) to insert
  • options (Object) – The operation handler options
  • context (Object) – A free form object to pass data between hook and handler methods
Return type Object[]
Description Update or transform the operation result before passing it back up to the HTTP layer
postInsertObject
Inherited fromCollection
Arguments
  • result (Object) – The inserted object
  • object (Object) – The object to insert
  • options (Object) – The operation handler options
  • context (Object) – A free form object to pass data between hook and handler methods
Return type Object
Description Update or transform the operation result before passing it back up to the HTTP layer
postInsertObjectOperation
Inherited fromCollection
Arguments
  • result (Object) – The inserted object
  • config (InsertObjectConfigClass) – The insert object operation config
  • req (Request) – The request object
  • res (Response) – The response object
  • context (Object) – A free form object to pass data between hook and handler methods
Returns Returns the inserted object if configured to do so and null otherwise
Return type Object | null
Description Update the HTTP response to reflect the result of the operation
postInsertOperation
Inherited fromCollection
Arguments
  • result (Object[]) – The inserted objects
  • config (InsertConfigClass) – The insert operation config
  • req (Request) – The request object
  • res (Response) – The response object
  • context (Object) – A free form object to pass data between hook and handler methods
Returns Returns the inserted objects if configured to do so and null otherwise
Return type Object[] | null
Description Update the HTTP response to reflect the result of the operation
postRemove
Inherited fromCollection
Arguments
  • result (number | array) – The number of objects (or the object(s) themselves) removed
  • options (Object) – The operation handler options
  • context (Object) – A free form object to pass data between hook and handler methods
Return type number | array
Description Update or transform the operation result before passing it back up to the HTTP layer
postRemoveObject
Inherited fromCollection
Arguments
  • result (number | Object) – The number of objects (or the object itself) removed
  • options (Object) – The operation handler options
  • context (Object) – A free form object to pass data between hook and handler methods
Return type number | array
Description Update or transform the operation result before passing it back up to the HTTP layer
postRemoveObjectOperation
Inherited fromCollection
Arguments
  • result (number | Object) – The number of objects removed or the removed object
  • config (RemoveObjectConfigClass) – The remove object operation config
  • req (Request) – The request object
  • res (Response) – The response object
  • context (Object) – A free form object to pass data between hook and handler methods
Returns Returns undefined} or the removed object
Return type Object
Description Update the HTTP response to reflect the result of the operation. It should be noted that the result can be either a number or an object. If the underlying driver does not support returning the removed object, then the result will always be a number and returnsRemovedObject should be configured to reflect this.
postRemoveOperation
Inherited fromCollection
Arguments
  • result (number | array) – The number of objects removed or the removed objec(s)
  • config (RemoveConfigClass) – The remove operation config
  • req (Request) – The request object
  • res (Response) – The response object
  • context (Object) – A free form object to pass data between hook and handler methods
Returns Returns undefined} or the removed objects
Return type Object
Description Update the HTTP response to reflect the result of the operation. It should be noted that the result can be either a number or an array of object(s). If the underlying driver does not support returning the removed object(s), then the result will always be a number and returnsRemovedObjects should be configured to reflect this.
postSave
Inherited fromCollection
Arguments
  • result (Object[]) – The saved objects
  • objects (Object[]) – The objects to save
  • options (Object) – The operation handler options
  • context (Object) – A free form object to pass data between hook and handler methods
Return type Object[]
Description Update or transform the operation result before passing it back up to the HTTP layer
postSaveObject
Inherited fromCollection
Arguments
  • result (SaveObjectResult) – The SaveObjectResult
  • object (Object) – The object to save
  • options (Object) – The operation handler options
  • context (Object) – A free form object to pass data between hook and handler methods
Return type SaveObjectResult
Description Update or transform the operation result before passing it back up to the HTTP layer
postSaveObjectOperation
Inherited fromCollection
Arguments
  • result (SaveObjectResult) – The saved object and a flag to indicate if it was created rather than replaced
  • config (SaveObjectConfigClass) – The save object operation config
  • req (Request) – The request object
  • res (Response) – The response object
  • context (Object) – A free form object to pass data between hook and handler methods
Returns Returns the saved object if configured to do so and null if not
Return type Object[] | null
Description Update the HTTP response to reflect the result of the operation
postSaveOperation
Inherited fromCollection
Arguments
  • result (Object[]) – The saved objects
  • config (saveConfig) – The save operation config
  • req (Request) – The request object
  • res (Response) – The response object
  • context (Object) – A free form object to pass data between hook and handler methods
Returns Returns the saved objects if configured to do so and null if not
Return type Object[] | null
Description Update the HTTP response to reflect the result of the operation
postUpdate
Inherited fromCollection
Arguments
  • result (UpdateResult) – The UpdateResult
  • update (*) – The update spec
  • options (Object) – The operation handler options
  • context (Object) – A free form object to pass data between hook and handler methods
Return type UpdateResult
Description Update or transform the operation result before passing it back up to the HTTP layer
postUpdateObject
Inherited fromCollection
Arguments
  • result (UpdateResult) – The UpdateResult
  • update (*) – The update spec
  • update – The update spec
  • options (Object) – The operation handler options
  • context (Object) – A free form object to pass data between hook and handler methods
Return type UpdateResult
Description Update or transform the operation result before passing it back up to the HTTP layer
postUpdateObjectOperation
Inherited fromCollection
Arguments
  • result (UpdateObjectResult) – The number of objects updated/upserted or the upserted object
  • config (UpdateObjectConfigClass) – The update object operation config
  • req (Request) – The request object
  • res (Response) – The response object
  • context (Object) – A free form object to pass data between hook and handler methods
Returns Returns undefined} or the upserted object
Return type Object
Description Update the HTTP response to reflect the result of the operation. It should be noted that the result can be either a number or an object. If the underlying driver does not support returning the upserted object, then the result will always be a number and returnsUpsertedObject should be configured to reflect this.
postUpdateOperation
Inherited fromCollection
Arguments
  • result (UpdateResult) – The number of objects updated/upserted or the upserted object(s)
  • config (UpdateConfigClass) – The update operation config
  • req (Request) – The request object
  • res (Response) – The response object
  • context (Object) – A free form object to pass data between hook and handler methods
Returns Returns undefined} or the upserted object(s)
Return type Object
Description Update the HTTP response to reflect the result of the operation. It should be noted that the result can be either a number or an array of objects. If the underlying driver does not support returning the upserted object(s), then the result will always be a number and returnsUpsertedObjects should be configured to reflect this.
preFind
Inherited fromCollection
Arguments
  • options (Object) – The operation handler options
  • context (Object) – A free form object to pass data between hook and handler methods
Return type PreFindResult | undefined
Description Update or transform any parameters to be passed to the operation handler
preFindObject
Inherited fromCollection
Arguments
  • id (string) – The object id
  • options (Object) – The operation handler options
  • context (Object) – A free form object to pass data between hook and handler methods
Return type PreFindObjectResult | undefined
Description Update or transform any parameters to be passed to the operation handler
preFindObjectOperation  
Arguments
  • config (FindObjectConfig) – The find object operation config
  • req (Request) – The request object
  • res (Response) – The response object
  • context (Object) – A free form object to pass data between hook and handler methods
Return type PreOperationResult
Description Build the options to be passed to the operation handler from the request and operation config. Note, in general, this should not need to be overridden or extended.
preFindOperation  
Arguments
  • config (FindConfig) – The find operation config
  • req (Request) – The request object
  • res (Response) – The response object
  • context (Object) – A free form object to pass data between hook and handler methods
Return type PreOperationResult
Description Build the options to be passed to the operation handler from the request and operation config. Note, in general, this should not need to be overridden or extended.
preInsert
Inherited fromCollection
Arguments
  • objects (Object[]) – The objects to insert
  • options (Object) – The operation handler options
  • context (Object) – A free form object to pass data between hook and handler methods
Return type PreInsertResult | undefined
Description Update or transform any parameters to be passed to the operation handler
preInsertObject
Inherited fromCollection
Arguments
  • object (Object) – The object to insert
  • options (Object) – The operation handler options
  • context (Object) – A free form object to pass data between hook and handler methods
Return type PreInsertObjectResult | undefined
Description Update or transform any parameters to be passed to the operation handler
preInsertObjectOperation  
Arguments
  • config (InsertObjectConfig) – The insert object operation config
  • req (Request) – The request object
  • res (Response) – The response object
  • context (Object) – A free form object to pass data between hook and handler methods
Return type PreOperationResult
Description Build the options to be passed to the operation handler from the request and operation config. Note, in general, this should not need to be overridden or extended.
preInsertOperation  
Arguments
  • config (InsertConfig) – The insert operation config
  • req (Request) – The request object
  • res (Response) – The response object
  • context (Object) – A free form object to pass data between hook and handler methods
Return type PreOperationResult
Description Build the options to be passed to the operation handler from the request and operation config. Note, in general, this should not need to be overridden or extended.
preRemove
Inherited fromCollection
Arguments
  • options (Object) – The operation handler options
  • context (Object) – A free form object to pass data between hook and handler methods
Return type PreRemoveResult | undefined
Description Update or transform any parameters to be passed to the operation handler
preRemoveObject
Inherited fromCollection
Arguments
  • id (string) – The object id
  • options (Object) – The operation handler options
  • context (Object) – A free form object to pass data between hook and handler methods
Return type PreRemoveObjectResult | undefined
Description Update or transform any parameters to be passed to the operation handler
preRemoveObjectOperation  
Arguments
  • config (RemoveObjectConfig) – The remove object operation config
  • req (Request) – The request object
  • res (Response) – The response object
  • context (Object) – A free form object to pass data between hook and handler methods
Return type PreOperationResult
Description Build the options to be passed to the operation handler from the request and operation config. Note, in general, this should not need to be overridden or extended.
preRemoveOperation  
Arguments
  • config (RemoveConfig) – The remove operation config
  • req (Request) – The request object
  • res (Response) – The response object
  • context (Object) – A free form object to pass data between hook and handler methods
Return type PreOperationResult
Description Build the options to be passed to the operation handler from the request and operation config. Note, in general, this should not need to be overridden or extended.
preSave
Inherited fromCollection
Arguments
  • objects (Object[]) – The objects to save
  • options (Object) – The operation handler options
  • context (Object) – A free form object to pass data between hook and handler methods
Return type PreSaveResult | undefined
Description Update or transform any parameters to be passed to the operation handler
preSaveObject
Inherited fromCollection
Arguments
  • object (Object) – The object to save
  • options (Object) – The operation handler options
  • context (Object) – A free form object to pass data between hook and handler methods
Return type PreSaveObjectResult | undefined
Description Update or transform any parameters to be passed to the operation handler
preSaveObjectOperation
Arguments
  • config (saveObjectConfig) – The save object operation config
  • req (Request) – The request object
  • res (Response) – The response object
  • context (Object) – A free form object to pass data between hook and handler methods
Return type PreOperationResult
Description Build the options to be passed to the operation handler from the request and operation config. Note, in general, this should not need to be overridden or extended.
preSaveOperation  
Arguments
  • config (SaveConfig) – The save operation config
  • req (Request) – The request object
  • res (Response) – The response object
  • context (Object) – A free form object to pass data between hook and handler methods
Return type PreOperationResult
Description Build the options to be passed to the operation handler from the request and operation config. Note, in general, this should not need to be overridden or extended.
preUpdate
Inherited fromCollection
Arguments
  • update (*) – The update spec
  • options (Object) – The operation handler options
  • context (Object) – A free form object to pass data between hook and handler methods
Return type PreUpdateResult | undefined
Description Update or transform any parameters to be passed to the operation handler
preUpdateObject
Inherited fromCollection
Arguments
  • id (string) – The object id
  • update (*) – The update spec
  • options (Object) – The operation handler options
  • context (Object) – A free form object to pass data between hook and handler methods
Return type PreUpdateObjectResult | undefined
Description Update or transform any parameters to be passed to the operation handler
preUpdateObjectOperation  
Arguments
  • config (UpdateObjectConfig) – The update object operation config
  • req (Request) – The request object
  • res (Response) – The response object
  • context (Object) – A free form object to pass data between hook and handler methods
Return type PreOperationResult
Description Build the options to be passed to the operation handler from the request and operation config. Note, in general, this should not need to be overridden or extended.
preUpdateOperation  
Arguments
  • config (UpdateConfig) – The update operation config
  • req (Request) – The request object
  • res (Response) – The response object
  • context (Object) – A free form object to pass data between hook and handler methods
Return type PreOperationResult
Description Build the options to be passed to the operation handler from the request and operation config. Note, in general, this should not need to be overridden or extended.
remove  
Arguments
  • options (Object) – The operation parameters (see: RemoveConfigClass)
  • context (Object) – A free form object to pass data between hook and handler methods
Throws CollectionError
Returns An integer representing the number of objects removed or an array of the objects removed
Return type number | array
Description Remove objects from a collection
removeObject  
Arguments
  • id (String) – The ID of the object to remove
  • options (Object) – The operation parameters (see: RemoveConfigClass)
  • context (Object) – A free form object to pass data between hook and handler methods
Throws CollectionError
Returns An integer representing the number of objects removed (0 or 1) or the the object removed
Return type number | Object
Description Remove a specific object from a collection
save  
Arguments
  • objects (Array) – An array of objects (with IDs) to save
  • options (Object) – The operation parameters (see: SaveConfigClass)
  • context (Object) – A free form object to pass data between hook and handler methods
Throws CollectionError
Returns The list of saved objects
Return type Object[]
Description Replace the collection with an array of objects
saveObject
overrides saveObject
Arguments
  • object (Object) – The object to save (with ID)
  • options (Object) – The operation parameters (see: SaveObjectConfigClass)
  • context (Object) – A free form object to pass data between hook and handler methods
Throws CollectionError
Return type SaveObjectResult
Description Replace or insert an object with a known ID
supportedMethods
Inherited fromCollection
Return type string[]
Description Returns a list of HTTP methods supported by this endpoint
update
overrides update
Arguments
  • update (Object) – The update to be applied to the collection
  • options (Object) – The operation parameters (see: UpdateConfigClass)
  • context (Object) – A free form object to pass data between hook and handler methods
Throws CollectionError
Return type UpdateResult
Description Update (or upsert) a number of objects in a collection
updateObject  
Arguments
  • id (string) – The ID of the object to update
  • update (Object) – The update to be applied to the collection
  • options (Object) – The operation parameters (see: UpdateObjectConfigClass)
  • context (Object) – A free form object to pass data between hook and handler methods
Throws CollectionError
Return type UpdateObjectResult
Description Update a specific object