carbond.mongodb.MongoDBCollection¶
extends Collection
A concrete implementation of Collection that supports MongoDB
Static Properties¶
- ¶
ALL_METHODS ObjectInherited fromCollectionRequired Description A list of all HTTP methods recognized by carbond
Instance Properties¶
- ¶
ALL_COLLECTION_OPERATIONS arrayInherited fromCollection(read-only)Description The list of valid collection operations
- ¶
allowUnauthenticated string[]Inherited fromCollectionRequired 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 stringRequired 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 stringDefault undefined Description The database name. Note, this is only needed if the Serviceinstance connects to multiple databases
- ¶
defaultErrorSchema ObjectInherited fromCollection(read-only)Description This is the default error body schema.
- ¶
defaultIdHeaderName stringInherited fromCollection(read-only)Description The default ID header name
- ¶
defaultIdParameter stringInherited fromCollection(read-only)Description The default ID name of objects in this collection
- ¶
defaultIdPathParameter stringInherited 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 stringInherited fromCollectionDefault undefined Description A brief description of what this endpoint does. This will be displayed in any generated documentation.
- ¶
enabled ObjectInherited fromCollectionDefault {'*': false}Description Control which collection level operations
- ¶
endpoints Object.<string, carbond.Endpoint>Inherited fromCollectionRequired 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 ObjectInherited fromCollectionDefault undefined Description An example object for this collection
- ¶
findConfig ObjectInherited fromCollectionDefault o({}, carbond.collections.FindConfigClass)Description The config used to govern the behavior of the findoperation
- ¶
FindConfigClass (read-only)Description The config class used to instantiate the findoperation config
- ¶
findObjectConfig ObjectInherited fromCollectionDefault o({}, carbond.collections.FindObjectConfigClass)Description The config used to govern the behavior of the findObjectoperation
- ¶
FindObjectConfigClass (read-only)Description The config class used to instantiate the findObjectoperation config
- ¶
idGenerator ObjectInherited fromCollectionDefault undefined Description An object with the method “generateId” that will be called to populate ID if present and when appropriate (e.g. insert)
- ¶
idHeaderName stringInherited fromCollectionDefault defaultIdHeaderNameDescription The header name which should contain the EJSON serialized ID
- ¶
idParameterName stringDefault '_id'Description The ID parameter name
- ¶
idPathParameterName stringInherited fromCollectionDefault defaultIdParameterDescription The PATH_ID parameter name (e.g., /collection/:PATH_ID)
- ¶
insertConfig ObjectInherited fromCollectionDefault o({}, carbond.collections.InsertConfigClass)Description The config used to govern the behavior of the insertoperation
- ¶
InsertConfigClass (read-only)Description The config class used to instantiate the insertoperation config
- ¶
insertObjectConfig ObjectInherited fromCollectionDefault o({}, carbond.collections.InsertObjectConfigClass)Description The config used to govern the behavior of the insertObjectoperation
- ¶
InsertObjectConfigClass (read-only)Description The config class used to instantiate the insertObjectoperation config
- ¶
noDocument booleanInherited fromCollectionDefault false Description Controls whether documentation for this endpoint is included in generated static documentation
- ¶
parameters Object.<string, carbond.OperationParameter>Inherited fromCollectionRequired 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 stringInherited 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 ObjectDefault undefined Description The JSON schema used to validate the query spec for query enabled operations (e.g., find)
- ¶
removeConfig ObjectInherited fromCollectionDefault o({}, carbond.collections.RemoveConfigClass)Description The config used to govern the behavior of the removeoperation
- ¶
RemoveConfigClass (read-only)Description The config class used to instantiate the removeoperation config
- ¶
removeObjectConfig ObjectInherited fromCollectionDefault o({}, carbond.collections.RemoveObjectConfigClass)Description The config used to govern the behavior of the removeObjectoperation
- ¶
RemoveObjectConfigClass RemoveObjectConfig(read-only)Description The config class used to instantiate the removeObjectoperation config
- ¶
saveConfig ObjectInherited fromCollectionDefault o({}, carbond.collections.SaveConfigClass)Description The config used to govern the behavior of the saveoperation
- ¶
MongoDBSaveConfigClass (read-only)Description The config class used to instantiate the saveoperation config
- ¶
saveObjectConfig ObjectInherited fromCollectionDefault o({}, carbond.collections.SaveObjectConfigClass)Description The config used to govern the behavior of the saveObjectoperation
- ¶
SaveObjectConfigClass (read-only)Description The config class used to instantiate the saveObjectoperation config
- ¶
schema ObjectInherited fromCollectionDefault defaultSchemaDescription 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 booleanInherited fromCollectionRequired Description Whether or not the findoperation is supported
- ¶
supportsFindObject booleanInherited fromCollectionRequired Description Whether or not the findObjectoperation is supported
- ¶
supportsInsert booleanInherited fromCollectionRequired Description Whether or not the insertoperation is supported
- ¶
supportsInsertObject booleanInherited fromCollectionRequired Description Whether or not the insertObjectoperation is supported
- ¶
supportsRemove booleanInherited fromCollectionRequired Description Whether or not the removeoperation is supported
- ¶
supportsRemoveObject booleanInherited fromCollectionRequired Description Whether or not the removeObjectoperation is supported
- ¶
supportsSave booleanInherited fromCollectionRequired Description Whether or not the saveoperation is supported
- ¶
supportsSaveObject booleanInherited fromCollectionRequired Description Whether or not the saveObjectoperation is supported
- ¶
supportsUpdate booleanInherited fromCollectionRequired Description Whether or not the updateoperation is supported
- ¶
supportsUpdateObject booleanInherited fromCollectionRequired Description Whether or not the updateObjectoperation is supported
- ¶
updateConfig ObjectInherited fromCollectionDefault o({}, carbond.collections.UpdateConfigClass)Description The config used to govern the behavior of the updateoperation
- ¶
UpdateConfigClass (read-only)Description The config class used to instantiate the updateoperation config
- ¶
updateObjectConfig ObjectInherited fromCollectionDefault o({}, carbond.collections.UpdateObjectConfigClass)Description The config used to govern the behavior of the updateObjectoperation
- ¶
UpdateObjectConfigClass (read-only)Description The config class used to instantiate the updateObjectoperation config
- ¶
updateObjectSchema ObjectDefault undefined Description The JSON schema used to validate the update spec passed to updateObject
- ¶
updateSchema ObjectDefault undefined Description The JSON schema used to validate the update spec passed to update
- ¶
validateOutput booleanInherited fromCollectionDefault trueDescription Controls whether or not response bodies are validated using the response schemacorresponding to the current response code
Methods¶
- ¶
configureFindObjectOperation Inherited fromCollectionReturn 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 fromCollectionReturn 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 fromCollectionReturn 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 fromCollectionReturn 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 fromCollectionReturn 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 fromCollectionReturn 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 fromCollectionReturn 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 fromCollectionReturn 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 fromCollectionReturn 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 fromCollectionReturn 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 CollectionErrorReturns A list of objects Return type Object[] Description Retrieve objects from a collection - options (Object) – The operation parameters (see:
- ¶
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 CollectionErrorReturns The found object or null Return type Object | null Description Retrieve a single object from a collection
- ¶
getOperation Inherited fromCollectionArguments - method (string) – The HTTP method corresponding to the operation to retrieve
Return type OperationDescription Retrieves the operation instance corresponding to the passed HTTP method
- ¶
getOperationConfig Inherited fromCollectionArguments - op (string) – The operation name (e.g., “insert”)
Return type CollectionOperationConfigDescription Get the config for an operation by name
- ¶
getOperationConfigFieldName Inherited fromCollectionArguments - op (string) – The operation name (e.g., “insert”)
Return type string Description Get the property name for an operation config by name
- ¶
getService Inherited fromCollectionReturn type ServiceDescription Returns the root Serviceinstance (note, this is preferred over accessing theserviceproperty 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 CollectionErrorReturns 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 CollectionErrorReturns The inserted object Return type Object Description Insert a single object into a collection
- ¶
isOperationAuthorized Inherited fromCollectionArguments - 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 Aclthat may apply to this endpoint
- ¶
operations Inherited fromCollectionReturn type Operation[]Description Gathers all operations defined on this endpoint
- ¶
options Inherited fromCollectionArguments Return type undefined Description Implements the OPTIONS method handler
- ¶
postFind Inherited fromCollectionArguments - 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 fromCollectionArguments - 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 fromCollectionArguments - 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 fromCollectionArguments - 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 fromCollectionArguments - 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 fromCollectionArguments - 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 fromCollectionArguments - 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 nullotherwiseReturn type Object | null Description Update the HTTP response to reflect the result of the operation
- ¶
postInsertOperation Inherited fromCollectionArguments - 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 nullotherwiseReturn type Object[] | null Description Update the HTTP response to reflect the result of the operation
- ¶
postRemove Inherited fromCollectionArguments - 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 fromCollectionArguments - 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 fromCollectionArguments - 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 returnsRemovedObjectshould be configured to reflect this.
- ¶
postRemoveOperation Inherited fromCollectionArguments - 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 returnsRemovedObjectsshould be configured to reflect this.
- ¶
postSave Inherited fromCollectionArguments - 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 fromCollectionArguments - 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 - result (SaveObjectResult) – The
- ¶
postSaveObjectOperation Inherited fromCollectionArguments - 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 nullif notReturn type Object[] | null Description Update the HTTP response to reflect the result of the operation
- ¶
postSaveOperation Inherited fromCollectionArguments - 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 nullif notReturn type Object[] | null Description Update the HTTP response to reflect the result of the operation
- ¶
postUpdate Inherited fromCollectionArguments - 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 - result (UpdateResult) – The
- ¶
postUpdateObject Inherited fromCollectionArguments - 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 - result (UpdateResult) – The
- ¶
postUpdateObjectOperation Inherited fromCollectionArguments - 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 returnsUpsertedObjectshould be configured to reflect this.
- ¶
postUpdateOperation Inherited fromCollectionArguments - 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 returnsUpsertedObjectsshould be configured to reflect this.
- ¶
preFind Inherited fromCollectionArguments - 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 fromCollectionArguments - 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. - config (
- ¶
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. - config (
- ¶
preInsert Inherited fromCollectionArguments - 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 fromCollectionArguments - 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. - config (
- ¶
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. - config (
- ¶
preRemove Inherited fromCollectionArguments - 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 fromCollectionArguments - 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. - config (
- ¶
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. - config (
- ¶
preSave Inherited fromCollectionArguments - 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 fromCollectionArguments - 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 overridespreSaveObjectOperationArguments - 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. - config (
- ¶
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. - config (
- ¶
preUpdate Inherited fromCollectionArguments - 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 fromCollectionArguments - 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. - config (
- ¶
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. - config (
- ¶
remove Arguments - options (Object) – The operation parameters (see:
RemoveConfigClass) - context (Object) – A free form object to pass data between hook and handler methods
Throws CollectionErrorReturns 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 - options (Object) – The operation parameters (see:
- ¶
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 CollectionErrorReturns 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 CollectionErrorReturns The list of saved objects Return type Object[] Description Replace the collection with an array of objects
- ¶
saveObject overridessaveObjectArguments - 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 CollectionErrorReturn type SaveObjectResult Description Replace or insert an object with a known ID
- ¶
supportedMethods Inherited fromCollectionReturn type string[] Description Returns a list of HTTP methods supported by this endpoint
- ¶
update overridesupdateArguments - 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 CollectionErrorReturn 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 CollectionErrorReturn type UpdateObjectResult Description Update a specific object