Class DefaultReactiveMongoRepositoryOperations
- java.lang.Object
-
- io.micronaut.data.runtime.operations.internal.AbstractRepositoryOperations
-
- io.micronaut.data.mongodb.operations.DefaultReactiveMongoRepositoryOperations
-
- All Implemented Interfaces:
io.micronaut.context.ApplicationContextProvider
,MongoReactiveRepositoryOperations
,MongoReactorRepositoryOperations
,HintsCapableRepository
,ReactiveRepositoryOperations
,ReactorReactiveRepositoryOperations
,ReactiveCascadeOperations.ReactiveCascadeOperationsHelper<DefaultReactiveMongoRepositoryOperations.MongoOperationContext>
,MethodContextAwareStoredQueryDecorator
,PreparedQueryDecorator
,ReactiveTransactionOperations<com.mongodb.reactivestreams.client.ClientSession>
,ReactorReactiveTransactionOperations<com.mongodb.reactivestreams.client.ClientSession>
@RequiresReactiveMongo @EachBean(com.mongodb.reactivestreams.client.MongoClient.class) @Internal public class DefaultReactiveMongoRepositoryOperations extends AbstractRepositoryOperations implements MongoReactorRepositoryOperations, ReactorReactiveRepositoryOperations, ReactiveCascadeOperations.ReactiveCascadeOperationsHelper<DefaultReactiveMongoRepositoryOperations.MongoOperationContext>, ReactorReactiveTransactionOperations<com.mongodb.reactivestreams.client.ClientSession>
The reactive MongoDB repository operations implementation.- Since:
- 3.3
- Author:
- Denis Stepanov
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
DefaultReactiveMongoRepositoryOperations.MongoOperationContext
-
Nested classes/interfaces inherited from interface io.micronaut.transaction.reactive.ReactiveTransactionOperations
ReactiveTransactionOperations.TransactionalCallback<C,T>
-
-
Field Summary
Fields Modifier and Type Field Description protected MongoCollectionNameProvider
collectionNameProvider
protected MongoDatabaseNameProvider
databaseNameProvider
protected static org.bson.BsonDocument
EMPTY
-
Fields inherited from class io.micronaut.data.runtime.operations.internal.AbstractRepositoryOperations
attributeConverterRegistry, conversionService, dateTimeProvider, entityEventRegistry, jsonCodec, runtimeEntityRegistry
-
Fields inherited from interface io.micronaut.transaction.reactive.ReactorReactiveTransactionOperations
TRANSACTION_DEFINITION_KEY_PREFIX, TRANSACTION_STATUS_KEY_PREFIX
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.bson.BsonDocument
association(org.bson.codecs.configuration.CodecRegistry codecRegistry, java.lang.Object value, RuntimePersistentEntity<java.lang.Object> persistentEntity, java.lang.Object child, RuntimePersistentEntity<java.lang.Object> childPersistentEntity)
protected <R> R
convertResult(org.bson.codecs.configuration.CodecRegistry codecRegistry, java.lang.Class<R> resultType, org.bson.BsonDocument result, boolean isDtoProjection)
<T> reactor.core.publisher.Mono<java.lang.Long>
count(PagedQuery<T> pagedQuery)
Counts all results for the given query.protected <T> org.bson.conversions.Bson
createFilterIdAndVersion(RuntimePersistentEntity<T> persistentEntity, T entity, org.bson.codecs.configuration.CodecRegistry codecRegistry)
<E,R>
StoredQuery<E,R>decorate(io.micronaut.aop.MethodInvocationContext<?,?> context, StoredQuery<E,R> storedQuery)
Decorate stored query.<E,R>
PreparedQuery<E,R>decorate(PreparedQuery<E,R> preparedQuery)
Decorate prepared query.<T> reactor.core.publisher.Mono<java.lang.Number>
delete(DeleteOperation<T> operation)
Deletes the entity.<T> reactor.core.publisher.Mono<java.lang.Number>
deleteAll(DeleteBatchOperation<T> operation)
Deletes all the entities of the given type.reactor.core.publisher.Mono<java.lang.Number>
executeDelete(PreparedQuery<?,java.lang.Number> preparedQuery)
Executes a batch delete for the given query and parameter values.reactor.core.publisher.Mono<java.lang.Number>
executeUpdate(PreparedQuery<?,java.lang.Number> preparedQuery)
Executes an update for the given query and parameter values.<T> reactor.core.publisher.Mono<java.lang.Boolean>
exists(PreparedQuery<T,java.lang.Boolean> preparedQuery)
Check with an record exists for the given query.<T> reactor.core.publisher.Flux<T>
findAll(PagedQuery<T> query)
Finds all results for the given query.<T,R>
reactor.core.publisher.Flux<R>findAll(PreparedQuery<T,R> preparedQuery)
Finds all results for the given query.<T,R>
reactor.core.publisher.Mono<R>findOne(PreparedQuery<T,R> preparedQuery)
Find one by Query.<T> reactor.core.publisher.Mono<T>
findOne(java.lang.Class<T> type, java.io.Serializable id)
Find one by ID.<T,R>
reactor.core.publisher.Mono<R>findOptional(PreparedQuery<T,R> preparedQuery)
Find one by Query.<T> reactor.core.publisher.Mono<T>
findOptional(java.lang.Class<T> type, java.io.Serializable id)
Find one by ID.<R> reactor.core.publisher.Mono<Page<R>>
findPage(PagedQuery<R> pagedQuery)
Find a page for the given entity and pageable.protected org.bson.codecs.configuration.CodecRegistry
getCodecRegistry(com.mongodb.reactivestreams.client.MongoDatabase mongoDatabase)
protected com.mongodb.reactivestreams.client.MongoDatabase
getDatabase(PersistentEntity persistentEntity, java.lang.Class<?> repository)
protected com.mongodb.client.model.DeleteOptions
getDeleteOptions(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata)
protected com.mongodb.client.model.InsertManyOptions
getInsertManyOptions(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata)
protected com.mongodb.client.model.InsertOneOptions
getInsertOneOptions(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata)
protected <E,R>
MongoPreparedQuery<E,R>getMongoPreparedQuery(PreparedQuery<E,R> preparedQuery)
protected <E,R>
MongoStoredQuery<E,R>getMongoStoredQuery(StoredQuery<E,R> storedQuery)
protected com.mongodb.client.model.ReplaceOptions
getReplaceOptions(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata)
TransactionDefinition
getTransactionDefinition(reactor.util.context.ContextView contextView)
Retrieve the transaction definition associated to the current transaction from the Reactor context.ReactiveTransactionStatus<com.mongodb.reactivestreams.client.ClientSession>
getTransactionStatus(reactor.util.context.ContextView contextView)
Retrieve the transaction status associated to the current transaction manager from the Reactor context.protected void
logAggregate(MongoAggregation aggregation)
protected void
logFind(MongoFind find)
<T> reactor.core.publisher.Mono<T>
persist(InsertOperation<T> operation)
Persist the entity returning a possibly new entity.<T> reactor.core.publisher.Flux<T>
persistAll(InsertBatchOperation<T> operation)
Persist all the given entities.<T> reactor.core.publisher.Flux<T>
persistBatch(DefaultReactiveMongoRepositoryOperations.MongoOperationContext ctx, java.lang.Iterable<T> values, RuntimePersistentEntity<T> persistentEntity, java.util.function.Predicate<T> predicate)
Persist multiple entities in batch during cascade.reactor.core.publisher.Mono<java.lang.Void>
persistManyAssociation(DefaultReactiveMongoRepositoryOperations.MongoOperationContext ctx, RuntimeAssociation runtimeAssociation, java.lang.Object value, RuntimePersistentEntity<java.lang.Object> persistentEntity, java.lang.Object child, RuntimePersistentEntity<java.lang.Object> childPersistentEntity)
Persist JOIN table relationship.reactor.core.publisher.Mono<java.lang.Void>
persistManyAssociationBatch(DefaultReactiveMongoRepositoryOperations.MongoOperationContext ctx, RuntimeAssociation runtimeAssociation, java.lang.Object value, RuntimePersistentEntity<java.lang.Object> persistentEntity, java.lang.Iterable<java.lang.Object> child, RuntimePersistentEntity<java.lang.Object> childPersistentEntity, java.util.function.Predicate<java.lang.Object> veto)
Persist JOIN table relationships in batch.<T> reactor.core.publisher.Mono<T>
persistOne(DefaultReactiveMongoRepositoryOperations.MongoOperationContext ctx, T value, RuntimePersistentEntity<T> persistentEntity)
Persist one entity during cascade.<T> reactor.core.publisher.Mono<T>
update(UpdateOperation<T> operation)
Updates the entity returning a possibly new entity.<T> reactor.core.publisher.Flux<T>
updateAll(UpdateBatchOperation<T> operation)
Updates the entities for the given operation.<T> reactor.core.publisher.Mono<T>
updateOne(DefaultReactiveMongoRepositoryOperations.MongoOperationContext ctx, T value, RuntimePersistentEntity<T> persistentEntity)
Update one entity during cascade.<T> reactor.core.publisher.Mono<T>
withClientSession(java.util.function.Function<com.mongodb.reactivestreams.client.ClientSession,reactor.core.publisher.Mono<? extends T>> function)
Starts a new session or reuses one from the context.<T> reactor.core.publisher.Flux<T>
withClientSessionMany(java.util.function.Function<com.mongodb.reactivestreams.client.ClientSession,reactor.core.publisher.Flux<? extends T>> function)
Starts a new session or reuses one from the context.<T> reactor.core.publisher.Flux<T>
withTransaction(TransactionDefinition definition, ReactiveTransactionOperations.TransactionalCallback<com.mongodb.reactivestreams.client.ClientSession,T> handler)
Execute the given handler with a new transaction.-
Methods inherited from class io.micronaut.data.runtime.operations.internal.AbstractRepositoryOperations
checkOptimisticLocking, getApplicationContext, getConversionService, getEntity, getIdReader, isOnlySingleEndedJoins, triggerPostLoad
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.micronaut.data.operations.HintsCapableRepository
getQueryHints
-
Methods inherited from interface io.micronaut.data.runtime.operations.internal.ReactiveCascadeOperations.ReactiveCascadeOperationsHelper
isSupportsBatchDelete, isSupportsBatchInsert, isSupportsBatchUpdate
-
Methods inherited from interface io.micronaut.transaction.reactive.ReactorReactiveTransactionOperations
withTransaction, withTransactionFlux, withTransactionFlux, withTransactionMono, withTransactionMono
-
-
-
-
Field Detail
-
EMPTY
protected static final org.bson.BsonDocument EMPTY
-
collectionNameProvider
protected final MongoCollectionNameProvider collectionNameProvider
-
databaseNameProvider
protected final MongoDatabaseNameProvider databaseNameProvider
-
-
Method Detail
-
findOne
public <T> reactor.core.publisher.Mono<T> findOne(java.lang.Class<T> type, java.io.Serializable id)
Description copied from interface:ReactiveRepositoryOperations
Find one by ID.- Specified by:
findOne
in interfaceReactiveRepositoryOperations
- Specified by:
findOne
in interfaceReactorReactiveRepositoryOperations
- Type Parameters:
T
- The generic type- Parameters:
type
- The typeid
- The id- Returns:
- A publisher that emits the result
-
findOne
public <T,R> reactor.core.publisher.Mono<R> findOne(PreparedQuery<T,R> preparedQuery)
Description copied from interface:ReactiveRepositoryOperations
Find one by Query.- Specified by:
findOne
in interfaceReactiveRepositoryOperations
- Specified by:
findOne
in interfaceReactorReactiveRepositoryOperations
- Type Parameters:
T
- The generic resultTypeR
- The result type- Parameters:
preparedQuery
- The prepared query- Returns:
- A publisher that emits the result
-
exists
public <T> reactor.core.publisher.Mono<java.lang.Boolean> exists(PreparedQuery<T,java.lang.Boolean> preparedQuery)
Description copied from interface:ReactiveRepositoryOperations
Check with an record exists for the given query.- Specified by:
exists
in interfaceReactiveRepositoryOperations
- Specified by:
exists
in interfaceReactorReactiveRepositoryOperations
- Type Parameters:
T
- The declaring type- Parameters:
preparedQuery
- The query- Returns:
- True if it exists
-
findAll
public <T> reactor.core.publisher.Flux<T> findAll(PagedQuery<T> query)
Description copied from interface:ReactiveRepositoryOperations
Finds all results for the given query.- Specified by:
findAll
in interfaceReactiveRepositoryOperations
- Specified by:
findAll
in interfaceReactorReactiveRepositoryOperations
- Type Parameters:
T
- The generic type- Parameters:
query
- The paged query- Returns:
- A publisher that emits the results
-
count
public <T> reactor.core.publisher.Mono<java.lang.Long> count(PagedQuery<T> pagedQuery)
Description copied from interface:ReactiveRepositoryOperations
Counts all results for the given query.- Specified by:
count
in interfaceReactiveRepositoryOperations
- Specified by:
count
in interfaceReactorReactiveRepositoryOperations
- Type Parameters:
T
- The generic type- Parameters:
pagedQuery
- The paged query- Returns:
- A publisher that emits the count as a long
-
findAll
public <T,R> reactor.core.publisher.Flux<R> findAll(PreparedQuery<T,R> preparedQuery)
Description copied from interface:ReactiveRepositoryOperations
Finds all results for the given query.- Specified by:
findAll
in interfaceReactiveRepositoryOperations
- Specified by:
findAll
in interfaceReactorReactiveRepositoryOperations
- Type Parameters:
T
- The entity typeR
- The result type- Parameters:
preparedQuery
- The prepared query- Returns:
- A publisher that emits an iterable with all results
-
findOptional
public <T> reactor.core.publisher.Mono<T> findOptional(java.lang.Class<T> type, java.io.Serializable id)
Description copied from interface:ReactiveRepositoryOperations
Find one by ID.- Specified by:
findOptional
in interfaceReactiveRepositoryOperations
- Specified by:
findOptional
in interfaceReactorReactiveRepositoryOperations
- Type Parameters:
T
- The generic type- Parameters:
type
- The typeid
- The id- Returns:
- A publisher that emits zero or one result
-
findOptional
public <T,R> reactor.core.publisher.Mono<R> findOptional(PreparedQuery<T,R> preparedQuery)
Description copied from interface:ReactiveRepositoryOperations
Find one by Query.- Specified by:
findOptional
in interfaceReactiveRepositoryOperations
- Specified by:
findOptional
in interfaceReactorReactiveRepositoryOperations
- Type Parameters:
T
- The generic resultTypeR
- The result type- Parameters:
preparedQuery
- The prepared query- Returns:
- A publisher that emits the zero or one result
-
findPage
public <R> reactor.core.publisher.Mono<Page<R>> findPage(PagedQuery<R> pagedQuery)
Description copied from interface:ReactiveRepositoryOperations
Find a page for the given entity and pageable.- Specified by:
findPage
in interfaceReactiveRepositoryOperations
- Specified by:
findPage
in interfaceReactorReactiveRepositoryOperations
- Type Parameters:
R
- The entity generic type- Parameters:
pagedQuery
- The paged query- Returns:
- The page type
-
persist
public <T> reactor.core.publisher.Mono<T> persist(InsertOperation<T> operation)
Description copied from interface:ReactiveRepositoryOperations
Persist the entity returning a possibly new entity.- Specified by:
persist
in interfaceReactiveRepositoryOperations
- Specified by:
persist
in interfaceReactorReactiveRepositoryOperations
- Type Parameters:
T
- The generic type- Parameters:
operation
- The entity operation- Returns:
- A publisher that emits the entity
-
persistAll
public <T> reactor.core.publisher.Flux<T> persistAll(InsertBatchOperation<T> operation)
Description copied from interface:ReactiveRepositoryOperations
Persist all the given entities.- Specified by:
persistAll
in interfaceReactiveRepositoryOperations
- Specified by:
persistAll
in interfaceReactorReactiveRepositoryOperations
- Type Parameters:
T
- The generic type- Parameters:
operation
- The batch operation- Returns:
- The entities, possibly mutated
-
update
public <T> reactor.core.publisher.Mono<T> update(UpdateOperation<T> operation)
Description copied from interface:ReactiveRepositoryOperations
Updates the entity returning a possibly new entity.- Specified by:
update
in interfaceReactiveRepositoryOperations
- Specified by:
update
in interfaceReactorReactiveRepositoryOperations
- Type Parameters:
T
- The generic type- Parameters:
operation
- The entity operation- Returns:
- A publisher that emits the entity
-
updateAll
public <T> reactor.core.publisher.Flux<T> updateAll(UpdateBatchOperation<T> operation)
Description copied from interface:ReactiveRepositoryOperations
Updates the entities for the given operation.- Specified by:
updateAll
in interfaceReactiveRepositoryOperations
- Specified by:
updateAll
in interfaceReactorReactiveRepositoryOperations
- Type Parameters:
T
- The generic type- Parameters:
operation
- The operation- Returns:
- The updated entities
-
delete
public <T> reactor.core.publisher.Mono<java.lang.Number> delete(DeleteOperation<T> operation)
Description copied from interface:ReactiveRepositoryOperations
Deletes the entity.- Specified by:
delete
in interfaceReactiveRepositoryOperations
- Specified by:
delete
in interfaceReactorReactiveRepositoryOperations
- Type Parameters:
T
- The generic type- Parameters:
operation
- The batch operation- Returns:
- A publisher that emits the number of entities deleted
-
deleteAll
public <T> reactor.core.publisher.Mono<java.lang.Number> deleteAll(DeleteBatchOperation<T> operation)
Description copied from interface:ReactiveRepositoryOperations
Deletes all the entities of the given type.- Specified by:
deleteAll
in interfaceReactiveRepositoryOperations
- Specified by:
deleteAll
in interfaceReactorReactiveRepositoryOperations
- Type Parameters:
T
- The generic type- Parameters:
operation
- The batch operation- Returns:
- A publisher that emits the number of entities deleted
-
executeUpdate
public reactor.core.publisher.Mono<java.lang.Number> executeUpdate(PreparedQuery<?,java.lang.Number> preparedQuery)
Description copied from interface:ReactiveRepositoryOperations
Executes an update for the given query and parameter values. If it is possible to return the number of objects updated, then do so.- Specified by:
executeUpdate
in interfaceReactiveRepositoryOperations
- Specified by:
executeUpdate
in interfaceReactorReactiveRepositoryOperations
- Parameters:
preparedQuery
- The prepared query- Returns:
- A publisher that emits a boolean true if the update was successful
-
executeDelete
public reactor.core.publisher.Mono<java.lang.Number> executeDelete(PreparedQuery<?,java.lang.Number> preparedQuery)
Description copied from interface:ReactiveRepositoryOperations
Executes a batch delete for the given query and parameter values. If it is possible to return the number of objects updated, then do so.- Specified by:
executeDelete
in interfaceReactiveRepositoryOperations
- Specified by:
executeDelete
in interfaceReactorReactiveRepositoryOperations
- Parameters:
preparedQuery
- The prepared query- Returns:
- A publisher that emits a boolean true if the update was successful
-
persistOne
public <T> reactor.core.publisher.Mono<T> persistOne(DefaultReactiveMongoRepositoryOperations.MongoOperationContext ctx, T value, RuntimePersistentEntity<T> persistentEntity)
Description copied from interface:ReactiveCascadeOperations.ReactiveCascadeOperationsHelper
Persist one entity during cascade.- Specified by:
persistOne
in interfaceReactiveCascadeOperations.ReactiveCascadeOperationsHelper<DefaultReactiveMongoRepositoryOperations.MongoOperationContext>
- Type Parameters:
T
- The entity type- Parameters:
ctx
- The contextvalue
- The entity valuepersistentEntity
- The persistent entity- Returns:
- The entity value
-
persistBatch
public <T> reactor.core.publisher.Flux<T> persistBatch(DefaultReactiveMongoRepositoryOperations.MongoOperationContext ctx, java.lang.Iterable<T> values, RuntimePersistentEntity<T> persistentEntity, java.util.function.Predicate<T> predicate)
Description copied from interface:ReactiveCascadeOperations.ReactiveCascadeOperationsHelper
Persist multiple entities in batch during cascade.- Specified by:
persistBatch
in interfaceReactiveCascadeOperations.ReactiveCascadeOperationsHelper<DefaultReactiveMongoRepositoryOperations.MongoOperationContext>
- Type Parameters:
T
- The entity type- Parameters:
ctx
- The contextvalues
- The entity valuespersistentEntity
- The persistent entitypredicate
- The veto predicate- Returns:
- The entity values
-
updateOne
public <T> reactor.core.publisher.Mono<T> updateOne(DefaultReactiveMongoRepositoryOperations.MongoOperationContext ctx, T value, RuntimePersistentEntity<T> persistentEntity)
Description copied from interface:ReactiveCascadeOperations.ReactiveCascadeOperationsHelper
Update one entity during cascade.- Specified by:
updateOne
in interfaceReactiveCascadeOperations.ReactiveCascadeOperationsHelper<DefaultReactiveMongoRepositoryOperations.MongoOperationContext>
- Type Parameters:
T
- The entity type- Parameters:
ctx
- The contextvalue
- The entity valuepersistentEntity
- The persistent entity- Returns:
- The entity value
-
getDatabase
protected com.mongodb.reactivestreams.client.MongoDatabase getDatabase(PersistentEntity persistentEntity, java.lang.Class<?> repository)
-
getCodecRegistry
protected org.bson.codecs.configuration.CodecRegistry getCodecRegistry(com.mongodb.reactivestreams.client.MongoDatabase mongoDatabase)
-
persistManyAssociation
public reactor.core.publisher.Mono<java.lang.Void> persistManyAssociation(DefaultReactiveMongoRepositoryOperations.MongoOperationContext ctx, RuntimeAssociation runtimeAssociation, java.lang.Object value, RuntimePersistentEntity<java.lang.Object> persistentEntity, java.lang.Object child, RuntimePersistentEntity<java.lang.Object> childPersistentEntity)
Description copied from interface:ReactiveCascadeOperations.ReactiveCascadeOperationsHelper
Persist JOIN table relationship.- Specified by:
persistManyAssociation
in interfaceReactiveCascadeOperations.ReactiveCascadeOperationsHelper<DefaultReactiveMongoRepositoryOperations.MongoOperationContext>
- Parameters:
ctx
- The contextruntimeAssociation
- The associationvalue
- The parent entity valuepersistentEntity
- The parent persistent entitychild
- The child entity valuechildPersistentEntity
- The child persistent entity- Returns:
- The empty mono
-
persistManyAssociationBatch
public reactor.core.publisher.Mono<java.lang.Void> persistManyAssociationBatch(DefaultReactiveMongoRepositoryOperations.MongoOperationContext ctx, RuntimeAssociation runtimeAssociation, java.lang.Object value, RuntimePersistentEntity<java.lang.Object> persistentEntity, java.lang.Iterable<java.lang.Object> child, RuntimePersistentEntity<java.lang.Object> childPersistentEntity, java.util.function.Predicate<java.lang.Object> veto)
Description copied from interface:ReactiveCascadeOperations.ReactiveCascadeOperationsHelper
Persist JOIN table relationships in batch.- Specified by:
persistManyAssociationBatch
in interfaceReactiveCascadeOperations.ReactiveCascadeOperationsHelper<DefaultReactiveMongoRepositoryOperations.MongoOperationContext>
- Parameters:
ctx
- The contextruntimeAssociation
- The associationvalue
- The parent entity valuepersistentEntity
- The parent persistent entitychild
- The child entity valueschildPersistentEntity
- The child persistent entityveto
- The veto predicate- Returns:
- The empty mono
-
withClientSession
public <T> reactor.core.publisher.Mono<T> withClientSession(java.util.function.Function<com.mongodb.reactivestreams.client.ClientSession,reactor.core.publisher.Mono<? extends T>> function)
Description copied from interface:MongoReactorRepositoryOperations
Starts a new session or reuses one from the context.- Specified by:
withClientSession
in interfaceMongoReactorRepositoryOperations
- Type Parameters:
T
- The emitted type- Parameters:
function
- The function- Returns:
- The processed publisher
-
withClientSessionMany
public <T> reactor.core.publisher.Flux<T> withClientSessionMany(java.util.function.Function<com.mongodb.reactivestreams.client.ClientSession,reactor.core.publisher.Flux<? extends T>> function)
Description copied from interface:MongoReactorRepositoryOperations
Starts a new session or reuses one from the context.- Specified by:
withClientSessionMany
in interfaceMongoReactorRepositoryOperations
- Type Parameters:
T
- The emitted type- Parameters:
function
- The function- Returns:
- The processed publisher
-
getTransactionStatus
public ReactiveTransactionStatus<com.mongodb.reactivestreams.client.ClientSession> getTransactionStatus(reactor.util.context.ContextView contextView)
Description copied from interface:ReactorReactiveTransactionOperations
Retrieve the transaction status associated to the current transaction manager from the Reactor context.- Specified by:
getTransactionStatus
in interfaceReactorReactiveTransactionOperations<com.mongodb.reactivestreams.client.ClientSession>
- Parameters:
contextView
- The context view- Returns:
- the key
-
getTransactionDefinition
public TransactionDefinition getTransactionDefinition(reactor.util.context.ContextView contextView)
Description copied from interface:ReactorReactiveTransactionOperations
Retrieve the transaction definition associated to the current transaction from the Reactor context.- Specified by:
getTransactionDefinition
in interfaceReactorReactiveTransactionOperations<com.mongodb.reactivestreams.client.ClientSession>
- Parameters:
contextView
- The context view- Returns:
- the key
-
withTransaction
@NonNull public <T> reactor.core.publisher.Flux<T> withTransaction(@NonNull TransactionDefinition definition, @NonNull ReactiveTransactionOperations.TransactionalCallback<com.mongodb.reactivestreams.client.ClientSession,T> handler)
Description copied from interface:ReactiveTransactionOperations
Execute the given handler with a new transaction.- Specified by:
withTransaction
in interfaceReactiveTransactionOperations<com.mongodb.reactivestreams.client.ClientSession>
- Specified by:
withTransaction
in interfaceReactorReactiveTransactionOperations<com.mongodb.reactivestreams.client.ClientSession>
- Type Parameters:
T
- The emitted type- Parameters:
definition
- The definitionhandler
- The handler- Returns:
- A publisher that emits the result type
-
getReplaceOptions
protected final com.mongodb.client.model.ReplaceOptions getReplaceOptions(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata)
-
getInsertOneOptions
protected final com.mongodb.client.model.InsertOneOptions getInsertOneOptions(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata)
-
getInsertManyOptions
protected final com.mongodb.client.model.InsertManyOptions getInsertManyOptions(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata)
-
getDeleteOptions
protected final com.mongodb.client.model.DeleteOptions getDeleteOptions(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata)
-
getMongoStoredQuery
protected <E,R> MongoStoredQuery<E,R> getMongoStoredQuery(StoredQuery<E,R> storedQuery)
-
getMongoPreparedQuery
protected <E,R> MongoPreparedQuery<E,R> getMongoPreparedQuery(PreparedQuery<E,R> preparedQuery)
-
decorate
public <E,R> PreparedQuery<E,R> decorate(PreparedQuery<E,R> preparedQuery)
Description copied from interface:PreparedQueryDecorator
Decorate prepared query.- Specified by:
decorate
in interfacePreparedQueryDecorator
- Type Parameters:
E
- The entity typeR
- The result type- Parameters:
preparedQuery
- The query to be decorated- Returns:
- decorated prepared query
-
decorate
public <E,R> StoredQuery<E,R> decorate(io.micronaut.aop.MethodInvocationContext<?,?> context, StoredQuery<E,R> storedQuery)
Description copied from interface:MethodContextAwareStoredQueryDecorator
Decorate stored query.- Specified by:
decorate
in interfaceMethodContextAwareStoredQueryDecorator
- Type Parameters:
E
- The entity typeR
- The result type- Parameters:
context
- The contextstoredQuery
- The query to be decorated- Returns:
- decorated stored query
-
convertResult
protected <R> R convertResult(org.bson.codecs.configuration.CodecRegistry codecRegistry, java.lang.Class<R> resultType, org.bson.BsonDocument result, boolean isDtoProjection)
-
association
protected org.bson.BsonDocument association(org.bson.codecs.configuration.CodecRegistry codecRegistry, java.lang.Object value, RuntimePersistentEntity<java.lang.Object> persistentEntity, java.lang.Object child, RuntimePersistentEntity<java.lang.Object> childPersistentEntity)
-
createFilterIdAndVersion
protected final <T> org.bson.conversions.Bson createFilterIdAndVersion(RuntimePersistentEntity<T> persistentEntity, T entity, org.bson.codecs.configuration.CodecRegistry codecRegistry)
-
logFind
protected void logFind(MongoFind find)
-
logAggregate
protected void logAggregate(MongoAggregation aggregation)
-
-