RequestOptions interface

Options that can be specified for a requested issued to the Azure Cosmos DB servers.=

Extends

Properties

accessCondition

Conditions Associated with the request.

consistencyLevel

Consistency level required by the client.

disableAutomaticIdGeneration

Disable automatic id generation (will cause creates to fail if id isn't on the definition)

disableRUPerMinuteUsage

DisableRUPerMinuteUsage is used to enable/disable Request Units(RUs)/minute capacity to serve the request if regular provisioned RUs/second is exhausted.

enableScriptLogging

Enables or disables logging in JavaScript stored procedures.

indexingDirective

Specifies indexing directives (index, do not index .. etc).

offerThroughput

The offer throughput provisioned for a container in measurement of Requests-per-Unit.

offerType

Offer type when creating document containers. This option is only valid when creating a document container.

populateQuotaInfo

Enables/disables getting document container quota related stats for document container read requests.

postTriggerInclude

Indicates what is the post trigger to be invoked after the operation.

preTriggerInclude

Indicates what is the pre trigger to be invoked before the operation.

resourceTokenExpirySeconds

Expiry time (in seconds) for resource token associated with permission (applicable only for requests on permissions).

urlConnection

(Advanced use case) The url to connect to.

Inherited Properties

abortSignal

abortSignal to pass to all underlying network requests created by this method call. See https://developer.mozilla.org/en-US/docs/Web/API/AbortController

Example

Cancel a read request

const controller = new AbortController()
const {result: item} = await items.query('SELECT * from c', { abortSignal: controller.signal});
controller.abort()
initialHeaders

(Advanced use case) Initial headers to start with when sending requests to Cosmos

maxIntegratedCacheStalenessInMs

Sets the staleness value associated with the request in the Azure CosmosDB service. For requests where the {@link com.azure.cosmos.ConsistencyLevel} is <xref:com.azure.cosmos.ConsistencyLevel%23EVENTUAL> or <xref:com.azure.cosmos.ConsistencyLevel%23SESSION>, responses from the integrated cache are guaranteed to be no staler than value indicated by this maxIntegratedCacheStaleness. When the consistency level is not set, this property is ignored.

Default value is null

Cache Staleness is supported in milliseconds granularity. Anything smaller than milliseconds will be ignored.

sessionToken

Enables/disables getting document container quota related stats for document container read requests.

Property Details

accessCondition

Conditions Associated with the request.

accessCondition?: { condition: string, type: string }

Property Value

{ condition: string, type: string }

consistencyLevel

Consistency level required by the client.

consistencyLevel?: string

Property Value

string

disableAutomaticIdGeneration

Disable automatic id generation (will cause creates to fail if id isn't on the definition)

disableAutomaticIdGeneration?: boolean

Property Value

boolean

disableRUPerMinuteUsage

DisableRUPerMinuteUsage is used to enable/disable Request Units(RUs)/minute capacity to serve the request if regular provisioned RUs/second is exhausted.

disableRUPerMinuteUsage?: boolean

Property Value

boolean

enableScriptLogging

Enables or disables logging in JavaScript stored procedures.

enableScriptLogging?: boolean

Property Value

boolean

indexingDirective

Specifies indexing directives (index, do not index .. etc).

indexingDirective?: string

Property Value

string

offerThroughput

The offer throughput provisioned for a container in measurement of Requests-per-Unit.

offerThroughput?: number

Property Value

number

offerType

Offer type when creating document containers. This option is only valid when creating a document container.

offerType?: string

Property Value

string

populateQuotaInfo

Enables/disables getting document container quota related stats for document container read requests.

populateQuotaInfo?: boolean

Property Value

boolean

postTriggerInclude

Indicates what is the post trigger to be invoked after the operation.

postTriggerInclude?: string | string[]

Property Value

string | string[]

preTriggerInclude

Indicates what is the pre trigger to be invoked before the operation.

preTriggerInclude?: string | string[]

Property Value

string | string[]

resourceTokenExpirySeconds

Expiry time (in seconds) for resource token associated with permission (applicable only for requests on permissions).

resourceTokenExpirySeconds?: number

Property Value

number

urlConnection

(Advanced use case) The url to connect to.

urlConnection?: string

Property Value

string

Inherited Property Details

abortSignal

abortSignal to pass to all underlying network requests created by this method call. See https://developer.mozilla.org/en-US/docs/Web/API/AbortController

Example

Cancel a read request

const controller = new AbortController()
const {result: item} = await items.query('SELECT * from c', { abortSignal: controller.signal});
controller.abort()
abortSignal?: AbortSignal_2

Property Value

AbortSignal_2

Inherited From SharedOptions.abortSignal

initialHeaders

(Advanced use case) Initial headers to start with when sending requests to Cosmos

initialHeaders?: CosmosHeaders

Property Value

Inherited From SharedOptions.initialHeaders

maxIntegratedCacheStalenessInMs

Sets the staleness value associated with the request in the Azure CosmosDB service. For requests where the {@link com.azure.cosmos.ConsistencyLevel} is <xref:com.azure.cosmos.ConsistencyLevel%23EVENTUAL> or <xref:com.azure.cosmos.ConsistencyLevel%23SESSION>, responses from the integrated cache are guaranteed to be no staler than value indicated by this maxIntegratedCacheStaleness. When the consistency level is not set, this property is ignored.

Default value is null

Cache Staleness is supported in milliseconds granularity. Anything smaller than milliseconds will be ignored.

maxIntegratedCacheStalenessInMs?: number

Property Value

number

Inherited From SharedOptions.maxIntegratedCacheStalenessInMs

sessionToken

Enables/disables getting document container quota related stats for document container read requests.

sessionToken?: string

Property Value

string

Inherited From SharedOptions.sessionToken