new Context()
The Context object provides access to all operations that can be performed on DocumentDB data, as well as access to the request and response objects.
- Source:
Methods
abort(err)
Terminates the script and rolls back the transaction. The script is executed in the context of a transaction, which can be rolled back by using this method. This method is the only way to prevent script transaction from committing in promise callback. For non-promise scenarios, to abort the transaction, using unhandled exception is more recommemded than this.
Parameters:
Name | Type | Description |
---|---|---|
err |
Object | The exception object to serve as the reason of the abort. |
- Source:
Example
getContext().abort(new Error('abort'));
getCollection() → {Collection}
Gets the collection object.
- Source:
Returns:
Object that provides server-side access to DocumentDB database. It supports operations on documents and attachments in the collection.
- Type
- Collection
getRequest() → {Request}
Gets the request object.
- Source:
Returns:
Object that provides access to the request message that was sent to the server.
- Type
- Request
getResponse() → {Response}
Gets the response object.
Note: this is not available in pre-triggers.
- Source:
Returns:
Object that provides access to output through the response message to be sent from the server.
- Type
- Response