I
InsightNexus

CosmosOperations (Azure SDK for Java Reference Documentation)

Author

Emma Terry

Published Feb 16, 2026

All Methods Instance Methods Abstract Methods Modifier and TypeMethod and Description<T> longcount(CosmosQuery query, String containerName)

Count

longcount(String containerName)

Count

CosmosContainerPropertiescreateContainerIfNotExists(CosmosEntityInformation<?,?> information)

Creates container if not exists

<T> Iterable<T>delete(CosmosQuery query, Class<T> domainType, String containerName)

Delete items matching query

voiddeleteAll(String containerName, Class<?> domainType)

Delete all items in a container

voiddeleteById(String containerName, Object id, PartitionKey partitionKey)

Delete an item by id

voiddeleteContainer(String containerName)

Delete container

voiddeleteEntityById(String containerName, Object entity, Object id, PartitionKey partitionKey)

Delete using entity

<T> Booleanexists(CosmosQuery query, Class<T> domainType, String containerName)

Exists

<T> Iterable<T>find(CosmosQuery query, Class<T> domainType, String containerName)

Find query

<T> Iterable<T>findAll(Class<T> domainType)

Find the DocumentQuery, find all the items specified by domain type.

<T> org.springframework.data.domain.Page<T>findAll(org.springframework.data.domain.Pageable pageable, Class<T> domainType, String containerName)

Find all items in a given container with partition key

<T> Iterable<T>findAll(PartitionKey partitionKey, Class<T> domainType)

Find the DocumentQuery, find all the items specified by domain type in the given container.

<T> Iterable<T>findAll(String containerName, Class<T> domainType)

Find the DocumentQuery, find all the items specified by domain type in the given container.

<T> TfindById(Object id, Class<T> domainType)

Finds item by id

<T> TfindById(Object id, Class<T> domainType, PartitionKey partitionKey)

Finds item by id

<T> TfindById(String containerName, Object id, Class<T> domainType)

Finds item by id

<T,ID> Iterable<T>findByIds(Iterable<ID> ids, Class<T> domainType, String containerName)

Find by ids

StringgetContainerName(Class<?> domainType)

To get container name by domainType

MappingCosmosConvertergetConverter()

To get converter

<T> Tinsert(String containerName, T objectToSave, PartitionKey partitionKey)

Inserts item

<T> Tinsert(T objectToSave, PartitionKey partitionKey)

Inserts item

<T> org.springframework.data.domain.Page<T>paginationQuery(CosmosQuery query, Class<T> domainType, String containerName)

Pagination query

<T> voidupsert(String containerName, T object)

Upserts an item into container with partition key

<T> voidupsert(T object)

Upserts an item with partition key

<T> TupsertAndReturnEntity(String containerName, T object)

Upserts an item and return item properties