Share via


ReactiveCosmosRepository<T,K> Interface

Type Parameters

T

the type of the domain class.

K

the type of the id of the entity the repository manages.

Implements

org.springframework.data.repository.reactive.ReactiveCrudRepository<T,K> org.springframework.data.repository.reactive.ReactiveSortingRepository<T,K>

public interface ReactiveCosmosRepository<T,K>
extends org.springframework.data.repository.reactive.ReactiveSortingRepository<T,K>, org.springframework.data.repository.reactive.ReactiveCrudRepository<T,K>

Repository interface with search and delete operation

Method Summary

Modifier and Type Method and Description
abstract Mono<Void> deleteById(K id, PartitionKey partitionKey)

Deletes an entity by its id and partition key.

abstract Flux<T> findAll(PartitionKey partitionKey)

Returns Flux of items in a specific partition

abstract Mono<T> findById(K id, PartitionKey partitionKey)

Retrieves an entity by its id and partition key.

abstract Mono<S> save(K id, PartitionKey partitionKey, Class<S> domainType, CosmosPatchOperations patchOperations)

Patches an entity by its id and partition key with CosmosPatchItemRequestOptions

abstract Mono<S> save(K id, PartitionKey partitionKey, Class<S> domainType, CosmosPatchOperations patchOperations, CosmosPatchItemRequestOptions options)

Patches an entity by its id and partition key with CosmosPatchItemRequestOptions

Method Details

deleteById

public abstract Mono<Void> deleteById(K id, PartitionKey partitionKey)

Deletes an entity by its id and partition key.

Parameters:

id - must not be null.
partitionKey - partition key value of the entity, must not be null.

Returns:

Mono emitting the void Mono.

findAll

public abstract Flux<T> findAll(PartitionKey partitionKey)

Returns Flux of items in a specific partition

Parameters:

partitionKey - partition key value

Returns:

Flux of items with partition key value

findById

public abstract Mono<T> findById(K id, PartitionKey partitionKey)

Retrieves an entity by its id and partition key.

Parameters:

id - must not be null.
partitionKey - partition key value of the entity, must not be null.

Returns:

Mono emitting the entity with the given id or Mono#empty() if none found.

save

public abstract Mono save(K id, PartitionKey partitionKey, Class domainType, CosmosPatchOperations patchOperations)

Patches an entity by its id and partition key with CosmosPatchItemRequestOptions

Parameters:

id - must not be null
partitionKey - must not be null
domainType - must not be null
patchOperations - must not be null, max operations is 10

Returns:

the patched entity

save

public abstract Mono save(K id, PartitionKey partitionKey, Class domainType, CosmosPatchOperations patchOperations, CosmosPatchItemRequestOptions options)

Patches an entity by its id and partition key with CosmosPatchItemRequestOptions

Parameters:

id - must not be null
partitionKey - must not be null
domainType - must not be null
patchOperations - must not be null, max operations is 10
options - Optional CosmosPatchItemRequestOptions, e.g. options.setFilterPredicate("FROM products p WHERE p.used = false");

Returns:

the patched entity

Applies to