Share via


Conflicts class

Use to query or read all conflicts.

See Conflict to read or delete a given Conflict by id.

Constructors

Conflicts(Container, ClientContext)

Properties

container

Methods

query(string | SqlQuerySpec, FeedOptions)

Queries all conflicts.

query<T>(string | SqlQuerySpec, FeedOptions)

Queries all conflicts.

Example

Query conflict with id

import { CosmosClient, SqlQuerySpec } from "@azure/cosmos";

const endpoint = "https://your-account.documents.azure.com";
const key = "<database account masterkey>";
const client = new CosmosClient({ endpoint, key });
const { database } = await client.databases.createIfNotExists({ id: "Test Database" });
const container = database.container("Test Container");

const querySpec: SqlQuerySpec = {
  query: `SELECT * FROM root r WHERE r.id = @conflict`,
  parameters: [{ name: "@conflict", value: "<conflict-id>" }],
};
const { resources: conflict } = await container.conflicts.query(querySpec).fetchAll();
readAll(FeedOptions)

Reads all conflicts

Example

import { CosmosClient } from "@azure/cosmos";

const endpoint = "https://your-account.documents.azure.com";
const key = "<database account masterkey>";
const client = new CosmosClient({ endpoint, key });
const { database } = await client.databases.createIfNotExists({ id: "Test Database" });
const container = database.container("Test Container");

const { resources: conflicts } = await container.conflicts.readAll().fetchAll();

Constructor Details

Conflicts(Container, ClientContext)

new Conflicts(container: Container, clientContext: ClientContext)

Parameters

container
Container
clientContext

ClientContext

Property Details

container

container: Container

Property Value

Method Details

query(string | SqlQuerySpec, FeedOptions)

Queries all conflicts.

function query(query: string | SqlQuerySpec, options?: FeedOptions): QueryIterator<any>

Parameters

query

string | SqlQuerySpec

Query configuration for the operation. See SqlQuerySpec for more info on how to configure a query.

options
FeedOptions

Use to set options like response page size, continuation tokens, etc.

Returns

QueryIterator Allows you to return results in an array or iterate over them one at a time.

query<T>(string | SqlQuerySpec, FeedOptions)

Queries all conflicts.

Example

Query conflict with id

import { CosmosClient, SqlQuerySpec } from "@azure/cosmos";

const endpoint = "https://your-account.documents.azure.com";
const key = "<database account masterkey>";
const client = new CosmosClient({ endpoint, key });
const { database } = await client.databases.createIfNotExists({ id: "Test Database" });
const container = database.container("Test Container");

const querySpec: SqlQuerySpec = {
  query: `SELECT * FROM root r WHERE r.id = @conflict`,
  parameters: [{ name: "@conflict", value: "<conflict-id>" }],
};
const { resources: conflict } = await container.conflicts.query(querySpec).fetchAll();
function query<T>(query: string | SqlQuerySpec, options?: FeedOptions): QueryIterator<T>

Parameters

query

string | SqlQuerySpec

Query configuration for the operation. See SqlQuerySpec for more info on how to configure a query.

options
FeedOptions

Use to set options like response page size, continuation tokens, etc.

Returns

QueryIterator Allows you to return results in an array or iterate over them one at a time.

readAll(FeedOptions)

Reads all conflicts

Example

import { CosmosClient } from "@azure/cosmos";

const endpoint = "https://your-account.documents.azure.com";
const key = "<database account masterkey>";
const client = new CosmosClient({ endpoint, key });
const { database } = await client.databases.createIfNotExists({ id: "Test Database" });
const container = database.container("Test Container");

const { resources: conflicts } = await container.conflicts.readAll().fetchAll();
function readAll(options?: FeedOptions): QueryIterator<ConflictDefinition & Resource>

Parameters

options
FeedOptions

Use to set options like response page size, continuation tokens, etc.

Returns