共用方式為


RequestOptions interface

可針對向 Azure Cosmos DB 伺服器發出的要求指定選項。=

Extends

屬性

accessCondition

與要求相關聯的條件。

consistencyLevel

用戶端所需的一致性層級。

disableAutomaticIdGeneration

停用自動產生識別碼(如果識別子不在定義上,會導致建立失敗)

disableRUPerMinuteUsage

DisableRUPerMinuteUsage 可用來啟用/停用要求單位(RU)/分鐘容量,以在一般布建 RU/秒用盡時提供要求。

enableScriptLogging

啟用或停用 JavaScript 預存程式中的記錄。

indexingDirective

指定索引指示詞(index、請勿編製索引等)。

offerThroughput

針對容器布建的供應專案輸送量,以測量每個單位的要求數。

offerType

建立檔案容器時的供應項目類型。

只有在建立文件容器時,此選項才有效。

populateQuotaInfo

啟用/停用取得檔容器讀取要求的檔容器配額相關統計數據。

postTriggerInclude

指出作業之後要叫用的張貼觸發程序是什麼。

preTriggerInclude

指出作業之前要叫用的預先觸發程序是什麼。

resourceTokenExpirySeconds

與許可權相關聯的資源令牌到期時間(以秒為單位)(僅適用於許可權的要求)。

urlConnection

(進階使用案例)要連接的 URL。

繼承的屬性

abortSignal

abortSignal 以傳遞至這個方法呼叫所建立的所有基礎網路要求。 請參閱 https://developer.mozilla.org/en-US/docs/Web/API/AbortController

範例

取消讀取要求

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

(進階使用案例)將要求傳送至 Cosmos 時要以開頭的初始標頭

maxIntegratedCacheStalenessInMs

設定與 Azure CosmosDB 服務中要求相關聯的過時值。 對於 <xref:com.azure.cosmos.ConsistencyLevel><xref:com.azure.cosmos.ConsistencyLevel%23EVENTUAL> 或 <xref:com.azure.cosmos.ConsistencyLevel%23SESSION>的要求,整合式快取的回應保證不會超過這個 maxIntegratedCacheStaleness 所指示的值。 未設定一致性層級時,會忽略這個屬性。

預設值為 null

快取過時是以毫秒為單位支持的數據粒度。 任何小於毫秒的任何項目都會被忽略。

priorityLevel

每個要求的優先順序層級(低/高)。 低優先順序要求一律會在任何高優先順序要求之前進行節流處理。

預設值為 null。 根據預設,所有要求都是高優先順序

sessionToken

啟用/停用取得檔容器讀取要求的檔容器配額相關統計數據。

屬性詳細資料

accessCondition

與要求相關聯的條件。

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

屬性值

{ condition: string, type: string }

consistencyLevel

用戶端所需的一致性層級。

consistencyLevel?: string

屬性值

string

disableAutomaticIdGeneration

停用自動產生識別碼(如果識別子不在定義上,會導致建立失敗)

disableAutomaticIdGeneration?: boolean

屬性值

boolean

disableRUPerMinuteUsage

DisableRUPerMinuteUsage 可用來啟用/停用要求單位(RU)/分鐘容量,以在一般布建 RU/秒用盡時提供要求。

disableRUPerMinuteUsage?: boolean

屬性值

boolean

enableScriptLogging

啟用或停用 JavaScript 預存程式中的記錄。

enableScriptLogging?: boolean

屬性值

boolean

indexingDirective

指定索引指示詞(index、請勿編製索引等)。

indexingDirective?: string

屬性值

string

offerThroughput

針對容器布建的供應專案輸送量,以測量每個單位的要求數。

offerThroughput?: number

屬性值

number

offerType

建立檔案容器時的供應項目類型。

只有在建立文件容器時,此選項才有效。

offerType?: string

屬性值

string

populateQuotaInfo

啟用/停用取得檔容器讀取要求的檔容器配額相關統計數據。

populateQuotaInfo?: boolean

屬性值

boolean

postTriggerInclude

指出作業之後要叫用的張貼觸發程序是什麼。

postTriggerInclude?: string | string[]

屬性值

string | string[]

preTriggerInclude

指出作業之前要叫用的預先觸發程序是什麼。

preTriggerInclude?: string | string[]

屬性值

string | string[]

resourceTokenExpirySeconds

與許可權相關聯的資源令牌到期時間(以秒為單位)(僅適用於許可權的要求)。

resourceTokenExpirySeconds?: number

屬性值

number

urlConnection

(進階使用案例)要連接的 URL。

urlConnection?: string

屬性值

string

繼承的屬性詳細資料

abortSignal

abortSignal 以傳遞至這個方法呼叫所建立的所有基礎網路要求。 請參閱 https://developer.mozilla.org/en-US/docs/Web/API/AbortController

範例

取消讀取要求

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

屬性值

AbortSignal

繼承自SharedOptions.abortSignal

initialHeaders

(進階使用案例)將要求傳送至 Cosmos 時要以開頭的初始標頭

initialHeaders?: CosmosHeaders

屬性值

繼承自SharedOptions.initialHeaders

maxIntegratedCacheStalenessInMs

設定與 Azure CosmosDB 服務中要求相關聯的過時值。 對於 <xref:com.azure.cosmos.ConsistencyLevel><xref:com.azure.cosmos.ConsistencyLevel%23EVENTUAL> 或 <xref:com.azure.cosmos.ConsistencyLevel%23SESSION>的要求,整合式快取的回應保證不會超過這個 maxIntegratedCacheStaleness 所指示的值。 未設定一致性層級時,會忽略這個屬性。

預設值為 null

快取過時是以毫秒為單位支持的數據粒度。 任何小於毫秒的任何項目都會被忽略。

maxIntegratedCacheStalenessInMs?: number

屬性值

number

繼承自SharedOptions.maxIntegratedCacheStalenessInMs

priorityLevel

每個要求的優先順序層級(低/高)。 低優先順序要求一律會在任何高優先順序要求之前進行節流處理。

預設值為 null。 根據預設,所有要求都是高優先順序

priorityLevel?: PriorityLevel

屬性值

繼承自SharedOptions.priorityLevel

sessionToken

啟用/停用取得檔容器讀取要求的檔容器配額相關統計數據。

sessionToken?: string

屬性值

string

繼承自SharedOptions.sessionToken