azure-docs-sdk-java/docs-ref-autogen/com.azure.cosmos.CosmosClie...

244 строки
25 KiB
YAML

### YamlMime:JavaType
uid: "com.azure.cosmos.CosmosClient"
fullName: "com.azure.cosmos.CosmosClient"
name: "CosmosClient"
nameWithType: "CosmosClient"
summary: "Provides a client-side logical representation of the Azure Cosmos DB service."
inheritances:
- "<xref href=\"java.lang.Object?displayProperty=fullName\" data-throw-if-not-resolved=\"False\" />"
inheritedClassMethods:
- classRef: "java.lang.<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>"
methodsRef:
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--\">clone</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-\">equals</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--\">finalize</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--\">getClass</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--\">hashCode</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--\">notify</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--\">notifyAll</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--\">toString</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--\">wait</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-\">wait</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-\">wait</a>"
syntax: "public final class **CosmosClient**</br> implements <a href=\"https://docs.oracle.com/javase/8/docs/api/java/io/Closeable.html\">Closeable</a>"
methods:
- uid: "com.azure.cosmos.CosmosClient.close()"
fullName: "com.azure.cosmos.CosmosClient.close()"
name: "close()"
nameWithType: "CosmosClient.close()"
summary: "Close this <xref uid=\"com.azure.cosmos.CosmosClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CosmosClient\"></xref> instance."
syntax: "public void close()"
desc: "Close this <xref uid=\"com.azure.cosmos.CosmosClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CosmosClient\"></xref> instance."
- uid: "com.azure.cosmos.CosmosClient.createDatabase(com.azure.cosmos.models.CosmosDatabaseProperties)"
fullName: "com.azure.cosmos.CosmosClient.createDatabase(CosmosDatabaseProperties databaseProperties)"
name: "createDatabase(CosmosDatabaseProperties databaseProperties)"
nameWithType: "CosmosClient.createDatabase(CosmosDatabaseProperties databaseProperties)"
summary: "Creates a Cosmos database."
parameters:
- description: "<xref uid=\"com.azure.cosmos.models.CosmosDatabaseProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CosmosDatabaseProperties\"></xref> the database properties."
name: "databaseProperties"
type: "<xref href=\"com.azure.cosmos.models.CosmosDatabaseProperties?alt=com.azure.cosmos.models.CosmosDatabaseProperties&text=CosmosDatabaseProperties\" data-throw-if-not-resolved=\"False\" />"
syntax: "public CosmosDatabaseResponse createDatabase(CosmosDatabaseProperties databaseProperties)"
desc: "Creates a Cosmos database.\n\n```java\nCosmosDatabaseProperties databaseProperties = new CosmosDatabaseProperties(databaseName);\n cosmosClient.createDatabase(databaseProperties);\n```"
returns:
description: "the <xref uid=\"com.azure.cosmos.models.CosmosDatabaseResponse\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CosmosDatabaseResponse\"></xref> with the created database."
type: "<xref href=\"com.azure.cosmos.models.CosmosDatabaseResponse?alt=com.azure.cosmos.models.CosmosDatabaseResponse&text=CosmosDatabaseResponse\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.cosmos.CosmosClient.createDatabase(com.azure.cosmos.models.CosmosDatabaseProperties,com.azure.cosmos.models.CosmosDatabaseRequestOptions)"
fullName: "com.azure.cosmos.CosmosClient.createDatabase(CosmosDatabaseProperties databaseProperties, CosmosDatabaseRequestOptions options)"
name: "createDatabase(CosmosDatabaseProperties databaseProperties, CosmosDatabaseRequestOptions options)"
nameWithType: "CosmosClient.createDatabase(CosmosDatabaseProperties databaseProperties, CosmosDatabaseRequestOptions options)"
summary: "Creates a database."
parameters:
- description: "<xref uid=\"com.azure.cosmos.models.CosmosDatabaseProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CosmosDatabaseProperties\"></xref> the database properties."
name: "databaseProperties"
type: "<xref href=\"com.azure.cosmos.models.CosmosDatabaseProperties?alt=com.azure.cosmos.models.CosmosDatabaseProperties&text=CosmosDatabaseProperties\" data-throw-if-not-resolved=\"False\" />"
- description: "the request options."
name: "options"
type: "<xref href=\"com.azure.cosmos.models.CosmosDatabaseRequestOptions?alt=com.azure.cosmos.models.CosmosDatabaseRequestOptions&text=CosmosDatabaseRequestOptions\" data-throw-if-not-resolved=\"False\" />"
syntax: "public CosmosDatabaseResponse createDatabase(CosmosDatabaseProperties databaseProperties, CosmosDatabaseRequestOptions options)"
desc: "Creates a database.\n\n```java\nCosmosDatabaseProperties databaseProperties = new CosmosDatabaseProperties(databaseName);\n cosmosClient.createDatabase(databaseProperties);\n```"
returns:
description: "the <xref uid=\"com.azure.cosmos.models.CosmosDatabaseResponse\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CosmosDatabaseResponse\"></xref> with the created database."
type: "<xref href=\"com.azure.cosmos.models.CosmosDatabaseResponse?alt=com.azure.cosmos.models.CosmosDatabaseResponse&text=CosmosDatabaseResponse\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.cosmos.CosmosClient.createDatabase(com.azure.cosmos.models.CosmosDatabaseProperties,com.azure.cosmos.models.ThroughputProperties)"
fullName: "com.azure.cosmos.CosmosClient.createDatabase(CosmosDatabaseProperties databaseProperties, ThroughputProperties throughputProperties)"
name: "createDatabase(CosmosDatabaseProperties databaseProperties, ThroughputProperties throughputProperties)"
nameWithType: "CosmosClient.createDatabase(CosmosDatabaseProperties databaseProperties, ThroughputProperties throughputProperties)"
summary: "Creates a Cosmos database."
parameters:
- description: "<xref uid=\"com.azure.cosmos.models.CosmosDatabaseProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CosmosDatabaseProperties\"></xref> the database properties."
name: "databaseProperties"
type: "<xref href=\"com.azure.cosmos.models.CosmosDatabaseProperties?alt=com.azure.cosmos.models.CosmosDatabaseProperties&text=CosmosDatabaseProperties\" data-throw-if-not-resolved=\"False\" />"
- description: "the throughput properties."
name: "throughputProperties"
type: "<xref href=\"com.azure.cosmos.models.ThroughputProperties?alt=com.azure.cosmos.models.ThroughputProperties&text=ThroughputProperties\" data-throw-if-not-resolved=\"False\" />"
syntax: "public CosmosDatabaseResponse createDatabase(CosmosDatabaseProperties databaseProperties, ThroughputProperties throughputProperties)"
desc: "Creates a Cosmos database.\n\n```java\nThroughputProperties throughputProperties = ThroughputProperties\n .createAutoscaledThroughput(autoScaleMaxThroughput);\n cosmosClient.createDatabase(databaseName, throughputProperties);\n```"
returns:
description: "the <xref uid=\"com.azure.cosmos.models.CosmosDatabaseResponse\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CosmosDatabaseResponse\"></xref> with the created database."
type: "<xref href=\"com.azure.cosmos.models.CosmosDatabaseResponse?alt=com.azure.cosmos.models.CosmosDatabaseResponse&text=CosmosDatabaseResponse\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.cosmos.CosmosClient.createDatabase(com.azure.cosmos.models.CosmosDatabaseProperties,com.azure.cosmos.models.ThroughputProperties,com.azure.cosmos.models.CosmosDatabaseRequestOptions)"
fullName: "com.azure.cosmos.CosmosClient.createDatabase(CosmosDatabaseProperties databaseProperties, ThroughputProperties throughputProperties, CosmosDatabaseRequestOptions options)"
name: "createDatabase(CosmosDatabaseProperties databaseProperties, ThroughputProperties throughputProperties, CosmosDatabaseRequestOptions options)"
nameWithType: "CosmosClient.createDatabase(CosmosDatabaseProperties databaseProperties, ThroughputProperties throughputProperties, CosmosDatabaseRequestOptions options)"
summary: "Creates a Cosmos database."
parameters:
- description: "<xref uid=\"com.azure.cosmos.models.CosmosDatabaseProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CosmosDatabaseProperties\"></xref> the database properties."
name: "databaseProperties"
type: "<xref href=\"com.azure.cosmos.models.CosmosDatabaseProperties?alt=com.azure.cosmos.models.CosmosDatabaseProperties&text=CosmosDatabaseProperties\" data-throw-if-not-resolved=\"False\" />"
- description: "the throughput properties."
name: "throughputProperties"
type: "<xref href=\"com.azure.cosmos.models.ThroughputProperties?alt=com.azure.cosmos.models.ThroughputProperties&text=ThroughputProperties\" data-throw-if-not-resolved=\"False\" />"
- description: "<xref uid=\"com.azure.cosmos.models.CosmosDatabaseRequestOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CosmosDatabaseRequestOptions\"></xref> the request options."
name: "options"
type: "<xref href=\"com.azure.cosmos.models.CosmosDatabaseRequestOptions?alt=com.azure.cosmos.models.CosmosDatabaseRequestOptions&text=CosmosDatabaseRequestOptions\" data-throw-if-not-resolved=\"False\" />"
syntax: "public CosmosDatabaseResponse createDatabase(CosmosDatabaseProperties databaseProperties, ThroughputProperties throughputProperties, CosmosDatabaseRequestOptions options)"
desc: "Creates a Cosmos database.\n\n```java\nThroughputProperties throughputProperties = ThroughputProperties\n .createAutoscaledThroughput(autoScaleMaxThroughput);\n cosmosClient.createDatabase(databaseName, throughputProperties);\n```"
returns:
description: "the <xref uid=\"com.azure.cosmos.models.CosmosDatabaseResponse\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CosmosDatabaseResponse\"></xref> with the created database."
type: "<xref href=\"com.azure.cosmos.models.CosmosDatabaseResponse?alt=com.azure.cosmos.models.CosmosDatabaseResponse&text=CosmosDatabaseResponse\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.cosmos.CosmosClient.createDatabase(java.lang.String)"
fullName: "com.azure.cosmos.CosmosClient.createDatabase(String id)"
name: "createDatabase(String id)"
nameWithType: "CosmosClient.createDatabase(String id)"
summary: "Creates a Cosmos database."
parameters:
- description: "the id of the database."
name: "id"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public CosmosDatabaseResponse createDatabase(String id)"
desc: "Creates a Cosmos database.\n\n```java\nCosmosDatabaseProperties databaseProperties = new CosmosDatabaseProperties(databaseName);\n cosmosClient.createDatabase(databaseProperties);\n```"
returns:
description: "the <xref uid=\"com.azure.cosmos.models.CosmosDatabaseResponse\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CosmosDatabaseResponse\"></xref> with the created database."
type: "<xref href=\"com.azure.cosmos.models.CosmosDatabaseResponse?alt=com.azure.cosmos.models.CosmosDatabaseResponse&text=CosmosDatabaseResponse\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.cosmos.CosmosClient.createDatabase(java.lang.String,com.azure.cosmos.models.ThroughputProperties)"
fullName: "com.azure.cosmos.CosmosClient.createDatabase(String id, ThroughputProperties throughputProperties)"
name: "createDatabase(String id, ThroughputProperties throughputProperties)"
nameWithType: "CosmosClient.createDatabase(String id, ThroughputProperties throughputProperties)"
summary: "Creates a Cosmos database."
parameters:
- description: "the id of the database."
name: "id"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "the throughput properties."
name: "throughputProperties"
type: "<xref href=\"com.azure.cosmos.models.ThroughputProperties?alt=com.azure.cosmos.models.ThroughputProperties&text=ThroughputProperties\" data-throw-if-not-resolved=\"False\" />"
syntax: "public CosmosDatabaseResponse createDatabase(String id, ThroughputProperties throughputProperties)"
desc: "Creates a Cosmos database.\n\n```java\nThroughputProperties throughputProperties = ThroughputProperties\n .createAutoscaledThroughput(autoScaleMaxThroughput);\n cosmosClient.createDatabase(databaseName, throughputProperties);\n```"
returns:
description: "the <xref uid=\"com.azure.cosmos.models.CosmosDatabaseResponse\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CosmosDatabaseResponse\"></xref> with the created database."
type: "<xref href=\"com.azure.cosmos.models.CosmosDatabaseResponse?alt=com.azure.cosmos.models.CosmosDatabaseResponse&text=CosmosDatabaseResponse\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.cosmos.CosmosClient.createDatabaseIfNotExists(java.lang.String)"
fullName: "com.azure.cosmos.CosmosClient.createDatabaseIfNotExists(String id)"
name: "createDatabaseIfNotExists(String id)"
nameWithType: "CosmosClient.createDatabaseIfNotExists(String id)"
summary: "Create a Cosmos database if it does not already exist on the service."
parameters:
- description: "the id of the database."
name: "id"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public CosmosDatabaseResponse createDatabaseIfNotExists(String id)"
desc: "Create a Cosmos database if it does not already exist on the service.\n\n```java\nCosmosDatabaseProperties databaseProperties = new CosmosDatabaseProperties(databaseName);\n cosmosClient.createDatabaseIfNotExists(databaseProperties);\n```"
returns:
description: "the <xref uid=\"com.azure.cosmos.models.CosmosDatabaseResponse\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CosmosDatabaseResponse\"></xref> with the created database."
type: "<xref href=\"com.azure.cosmos.models.CosmosDatabaseResponse?alt=com.azure.cosmos.models.CosmosDatabaseResponse&text=CosmosDatabaseResponse\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.cosmos.CosmosClient.createDatabaseIfNotExists(java.lang.String,com.azure.cosmos.models.ThroughputProperties)"
fullName: "com.azure.cosmos.CosmosClient.createDatabaseIfNotExists(String id, ThroughputProperties throughputProperties)"
name: "createDatabaseIfNotExists(String id, ThroughputProperties throughputProperties)"
nameWithType: "CosmosClient.createDatabaseIfNotExists(String id, ThroughputProperties throughputProperties)"
summary: "Create a Cosmos database if it does not already exist on the service."
parameters:
- description: "the id of the database."
name: "id"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "the throughputProperties."
name: "throughputProperties"
type: "<xref href=\"com.azure.cosmos.models.ThroughputProperties?alt=com.azure.cosmos.models.ThroughputProperties&text=ThroughputProperties\" data-throw-if-not-resolved=\"False\" />"
syntax: "public CosmosDatabaseResponse createDatabaseIfNotExists(String id, ThroughputProperties throughputProperties)"
desc: "Create a Cosmos database if it does not already exist on the service.\n\n```java\nThroughputProperties throughputProperties = ThroughputProperties\n .createAutoscaledThroughput(autoScaleMaxThroughput);\n cosmosClient.createDatabaseIfNotExists(databaseName, throughputProperties);\n```\n\nThe throughputProperties will only be used if the specified database does not exist and therefor a new database will be created with throughputProperties."
returns:
description: "the <xref uid=\"com.azure.cosmos.models.CosmosDatabaseResponse\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CosmosDatabaseResponse\"></xref> with the created database."
type: "<xref href=\"com.azure.cosmos.models.CosmosDatabaseResponse?alt=com.azure.cosmos.models.CosmosDatabaseResponse&text=CosmosDatabaseResponse\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.cosmos.CosmosClient.createGlobalThroughputControlConfigBuilder(java.lang.String,java.lang.String)"
fullName: "com.azure.cosmos.CosmosClient.createGlobalThroughputControlConfigBuilder(String databaseId, String containerId)"
name: "createGlobalThroughputControlConfigBuilder(String databaseId, String containerId)"
nameWithType: "CosmosClient.createGlobalThroughputControlConfigBuilder(String databaseId, String containerId)"
summary: "Create global throughput control config builder which will be used to build <xref uid=\"com.azure.cosmos.GlobalThroughputControlConfig\" data-throw-if-not-resolved=\"false\" data-raw-source=\"GlobalThroughputControlConfig\"></xref>."
parameters:
- description: "The database id of the control container."
name: "databaseId"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The container id of the control container."
name: "containerId"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public GlobalThroughputControlConfigBuilder createGlobalThroughputControlConfigBuilder(String databaseId, String containerId)"
desc: "Create global throughput control config builder which will be used to build <xref uid=\"com.azure.cosmos.GlobalThroughputControlConfig\" data-throw-if-not-resolved=\"false\" data-raw-source=\"GlobalThroughputControlConfig\"></xref>."
returns:
description: "A <xref uid=\"com.azure.cosmos.GlobalThroughputControlConfigBuilder\" data-throw-if-not-resolved=\"false\" data-raw-source=\"GlobalThroughputControlConfigBuilder\"></xref>."
type: "<xref href=\"com.azure.cosmos.GlobalThroughputControlConfigBuilder?alt=com.azure.cosmos.GlobalThroughputControlConfigBuilder&text=GlobalThroughputControlConfigBuilder\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.cosmos.CosmosClient.getDatabase(java.lang.String)"
fullName: "com.azure.cosmos.CosmosClient.getDatabase(String id)"
name: "getDatabase(String id)"
nameWithType: "CosmosClient.getDatabase(String id)"
summary: "Gets the Cosmos database instance without making a service call."
parameters:
- description: "the id of the database."
name: "id"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public CosmosDatabase getDatabase(String id)"
desc: "Gets the Cosmos database instance without making a service call."
returns:
description: "<xref uid=\"com.azure.cosmos.CosmosDatabase\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CosmosDatabase\"></xref> the cosmos sync database."
type: "<xref href=\"com.azure.cosmos.CosmosDatabase?alt=com.azure.cosmos.CosmosDatabase&text=CosmosDatabase\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.cosmos.CosmosClient.queryDatabases(com.azure.cosmos.models.SqlQuerySpec,com.azure.cosmos.models.CosmosQueryRequestOptions)"
fullName: "com.azure.cosmos.CosmosClient.queryDatabases(SqlQuerySpec querySpec, CosmosQueryRequestOptions options)"
name: "queryDatabases(SqlQuerySpec querySpec, CosmosQueryRequestOptions options)"
nameWithType: "CosmosClient.queryDatabases(SqlQuerySpec querySpec, CosmosQueryRequestOptions options)"
summary: "Query a Cosmos database."
parameters:
- description: "<xref uid=\"com.azure.cosmos.models.SqlQuerySpec\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SqlQuerySpec\"></xref> the query spec."
name: "querySpec"
type: "<xref href=\"com.azure.cosmos.models.SqlQuerySpec?alt=com.azure.cosmos.models.SqlQuerySpec&text=SqlQuerySpec\" data-throw-if-not-resolved=\"False\" />"
- description: "the query request options."
name: "options"
type: "<xref href=\"com.azure.cosmos.models.CosmosQueryRequestOptions?alt=com.azure.cosmos.models.CosmosQueryRequestOptions&text=CosmosQueryRequestOptions\" data-throw-if-not-resolved=\"False\" />"
syntax: "public CosmosPagedIterable<CosmosDatabaseProperties> queryDatabases(SqlQuerySpec querySpec, CosmosQueryRequestOptions options)"
desc: "Query a Cosmos database.\n\n```java\nCosmosQueryRequestOptions options = new CosmosQueryRequestOptions();\n CosmosPagedIterable<CosmosDatabaseProperties> databaseProperties =\n cosmosClient.queryDatabases(\"select * from d\", options);\n databaseProperties.forEach(properties -> {\n System.out.println(properties.getId());\n });\n```"
returns:
description: "the <xref uid=\"com.azure.cosmos.util.CosmosPagedIterable\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CosmosPagedIterable\"></xref> for feed response with the obtained databases."
type: "<xref href=\"com.azure.cosmos.util.CosmosPagedIterable?alt=com.azure.cosmos.util.CosmosPagedIterable&text=CosmosPagedIterable\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.cosmos.models.CosmosDatabaseProperties?alt=com.azure.cosmos.models.CosmosDatabaseProperties&text=CosmosDatabaseProperties\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.azure.cosmos.CosmosClient.queryDatabases(java.lang.String,com.azure.cosmos.models.CosmosQueryRequestOptions)"
fullName: "com.azure.cosmos.CosmosClient.queryDatabases(String query, CosmosQueryRequestOptions options)"
name: "queryDatabases(String query, CosmosQueryRequestOptions options)"
nameWithType: "CosmosClient.queryDatabases(String query, CosmosQueryRequestOptions options)"
summary: "Query a Cosmos database."
parameters:
- description: "the query."
name: "query"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "<xref uid=\"com.azure.cosmos.models.CosmosQueryRequestOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CosmosQueryRequestOptions\"></xref>the feed options."
name: "options"
type: "<xref href=\"com.azure.cosmos.models.CosmosQueryRequestOptions?alt=com.azure.cosmos.models.CosmosQueryRequestOptions&text=CosmosQueryRequestOptions\" data-throw-if-not-resolved=\"False\" />"
syntax: "public CosmosPagedIterable<CosmosDatabaseProperties> queryDatabases(String query, CosmosQueryRequestOptions options)"
desc: "Query a Cosmos database.\n\n```java\nCosmosQueryRequestOptions options = new CosmosQueryRequestOptions();\n CosmosPagedIterable<CosmosDatabaseProperties> databaseProperties =\n cosmosClient.queryDatabases(\"select * from d\", options);\n databaseProperties.forEach(properties -> {\n System.out.println(properties.getId());\n });\n```"
returns:
description: "the <xref uid=\"com.azure.cosmos.util.CosmosPagedIterable\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CosmosPagedIterable\"></xref> for feed response with the obtained databases."
type: "<xref href=\"com.azure.cosmos.util.CosmosPagedIterable?alt=com.azure.cosmos.util.CosmosPagedIterable&text=CosmosPagedIterable\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.cosmos.models.CosmosDatabaseProperties?alt=com.azure.cosmos.models.CosmosDatabaseProperties&text=CosmosDatabaseProperties\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.azure.cosmos.CosmosClient.readAllDatabases()"
fullName: "com.azure.cosmos.CosmosClient.readAllDatabases()"
name: "readAllDatabases()"
nameWithType: "CosmosClient.readAllDatabases()"
summary: "Reads all Cosmos databases."
syntax: "public CosmosPagedIterable<CosmosDatabaseProperties> readAllDatabases()"
desc: "Reads all Cosmos databases.\n\n```java\nCosmosPagedIterable<CosmosDatabaseProperties> cosmosDatabaseProperties =\n cosmosClient.readAllDatabases();\n cosmosDatabaseProperties.forEach(databaseProperties -> {\n System.out.println(databaseProperties);\n });\n```"
returns:
description: "the <xref uid=\"com.azure.cosmos.util.CosmosPagedIterable\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CosmosPagedIterable\"></xref> for feed response with the read databases."
type: "<xref href=\"com.azure.cosmos.util.CosmosPagedIterable?alt=com.azure.cosmos.util.CosmosPagedIterable&text=CosmosPagedIterable\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.cosmos.models.CosmosDatabaseProperties?alt=com.azure.cosmos.models.CosmosDatabaseProperties&text=CosmosDatabaseProperties\" data-throw-if-not-resolved=\"False\" />&gt;"
type: "class"
desc: "Provides a client-side logical representation of the Azure Cosmos DB service. Calls to CosmosClient API's are blocked for completion.\n\nCosmosClient is thread-safe. It's recommended to maintain a single instance of CosmosClient per lifetime of the application which enables efficient connection management and performance. CosmosClient initialization is a heavy operation - don't use initialization CosmosClient instances as credentials or network connectivity validations."
implements:
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/io/Closeable.html\">Closeable</a>"
metadata: {}
package: "com.azure.cosmos"
artifact: com.azure:azure-cosmos:4.63.3