Package version:

Interface ConnectionPolicy

Represents the Connection policy associated with a CosmosClient in the Azure Cosmos DB database service.

interface ConnectionPolicy {
    connectionMode?: Gateway;
    enableBackgroundEndpointRefreshing?: boolean;
    enableEndpointDiscovery?: boolean;
    endpointRefreshRateInMs?: number;
    preferredLocations?: string[];
    requestTimeout?: number;
    retryOptions?: RetryOptions;
    useMultipleWriteLocations?: boolean;
}

Properties

connectionMode?: Gateway

Determines which mode to connect to Cosmos with. (Currently only supports Gateway option)

enableBackgroundEndpointRefreshing?: boolean

Flag to enable/disable background refreshing of endpoints. Defaults to false. Endpoint discovery using enableEndpointsDiscovery will still work for failed requests.

enableEndpointDiscovery?: boolean

Flag to enable/disable automatic redirecting of requests based on read/write operations. Default true. Required to call client.dispose() when this is set to true after destroying the CosmosClient inside another process or in the browser.

endpointRefreshRateInMs?: number

Rate in milliseconds at which the client will refresh the endpoints list in the background

preferredLocations?: string[]

List of azure regions to be used as preferred locations for read requests.

requestTimeout?: number

Request timeout (time to wait for response from network peer). Represented in milliseconds.

retryOptions?: RetryOptions

RetryOptions object which defines several configurable properties used during retry.

useMultipleWriteLocations?: boolean

The flag that enables writes on any locations (regions) for geo-replicated database accounts in the Azure Cosmos DB service. Default is false.