Reference

Endpoint Get Document by Id


Name

get_document

Description

Gets Document by Id. [API reference]

Related Tables

[Dynamic Table]

Parameters

Parameter Required Options
Name: Id

Label: Document Id

YES
Name: Table

Label: Table Name (Case-Sensitive)

YES
Name: Database

Label: Database Name (keep blank to use default) Case-Sensitive

Leave blank to use default DB set on connection screen
Name: EnableCrossPartition

Label: EnableCrossPartition

Option Value
true true
false false
Name: PartitionKey

Label: Partition Key Value (default is supplied Id)

The partition key value for the document. Must be included if and only if the collection is created with a partitionKey definition
Option Value
Default .
SingleKeyValue ["someValue1"]
MultiKeyValue ["some_value1","some_value2" ]
Name: ConsistencyLevel

Label: ConsistencyLevel

This is the consistency level override. The valid values are: Strong, Bounded, Session, or Eventual (in order of strongest to weakest). The override must be the same or weaker than the account's configured consistency level.
Option Value
Strong Strong
Bounded Bounded
Session Session
Eventual Eventual

Output Columns

Label Data Type (SSIS) Data Type (SQL) Length Description
There are no Static columns defined for this endpoint. This endpoint detects columns dynamically at runtime.
If the column you are looking for is missing, consider customizing Cosmos DB Connector.

Input Columns

Label Data Type (SSIS) Data Type (SQL) Length Description
There are no Static columns defined for this endpoint. This endpoint detects columns dynamically at runtime.

Examples

SSIS

Use Cosmos DB Connector in API Source or in API Destination SSIS Data Flow components to read or write data.

API Source

This Endpoint belongs to the [Dynamic Table] table, therefore it is better to use it, instead of accessing the endpoint directly:

API Source - Cosmos DB
Connect to your Azure Cosmos DB databases to read, query, create, update, and delete documents and more!
Cosmos DB
[Dynamic Table]
Required Parameters
Document Id Fill-in the parameter...
Table Name (Case-Sensitive) Fill-in the parameter...
Optional Parameters
Database Name (keep blank to use default) Case-Sensitive
EnableCrossPartition true
Partition Key Value (default is supplied Id) .
ConsistencyLevel
SSIS API Source - Read from table or endpoint

API Destination

This Endpoint belongs to the [Dynamic Table] table, therefore it is better to use it, instead of accessing the endpoint directly. Use this table and table-operation pair to get document by id:

API Destination - Cosmos DB
Connect to your Azure Cosmos DB databases to read, query, create, update, and delete documents and more!
Cosmos DB
[Dynamic Table]
Lookup
Required Parameters
Document Id Fill-in the parameter...
Table Name (Case-Sensitive) Fill-in the parameter...
Optional Parameters
Database Name (keep blank to use default) Case-Sensitive
EnableCrossPartition true
Partition Key Value (default is supplied Id) .
ConsistencyLevel
SSIS API Destination - Access table operation

ODBC application

Use these SQL queries in your ODBC application data source:

Read a document by Id from a collection in Cosmos DB

Read a single document by Id from a collection in Cosmos DB.

SELECT * FROM TestContainer Where Id='user2'

get_document endpoint belongs to [Dynamic Table] table(s), and can therefore be used via those table(s).

SQL Server

Use these SQL queries in SQL Server after you create a data source in Data Gateway:

Read a document by Id from a collection in Cosmos DB

Read a single document by Id from a collection in Cosmos DB.

DECLARE @MyQuery NVARCHAR(MAX) = 'SELECT * FROM TestContainer Where Id=''user2''';

EXEC (@MyQuery) AT [LS_TO_COSMOS_DB_IN_GATEWAY];

get_document endpoint belongs to [Dynamic Table] table(s), and can therefore be used via those table(s).