
ftl.data.mongo.method.$$MongoRepositoryCountDocumentsMethodBodyTemplateftl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rxmicro-annotation-processor-data-mongo Show documentation
Show all versions of rxmicro-annotation-processor-data-mongo Show documentation
The RxMicro Annotation Processor internal module that generates Mongo DB components.
<#include "../mongo-lib.javaftl">
<#-- -------------------------------------------------------------------------------------------------------- -->
<#if QUERY??>
${createBsonVar('query', QUERY)}
#if>
<#if HINT??>
${createBsonVar('hint', HINT)}
#if>
<#-- -------------------------------------------------------------------------------------------------------- -->
<#if HINT?? || LIMIT?? || SKIP??>
final Publisher result = collection
.countDocuments(<#if QUERY??>query, <#else>MongoQueries.NULL, #if>new CountOptions()
<#if HINT??>
.hint(hint)
#if>
<#if LIMIT??>
.limit(${LIMIT})
#if>
<#if SKIP??>
.skip(${SKIP})
#if>
);
<#else>
final Publisher result = collection
.countDocuments(<#if QUERY??>query#if>);
#if>
<#-- -------------------------------------------------------------------------------------------------------- -->
<#-- -------------------------------------------------------------------------------------------------------- -->
<#-- -------------------------------------------------------------------------------------------------------- -->
<#if RETURN.mono>
return Mono.from(result);
<#-- -------------------------------------------------------------------------------------------------------- -->
<#elseif RETURN.future>
return new PublisherToRequiredMonoFutureAdapter<>(
result,
useOptionalExceptionSupplier(${RETURN.simpleReactiveType}.class, ${RETURN.simpleResultType}.class)
);
<#-- -------------------------------------------------------------------------------------------------------- -->
<#elseif RETURN.single>
return Single.fromPublisher(result);
<#-- -------------------------------------------------------------------------------------------------------- -->
<#else>
//"RxMicro does not know how to generate this method";
#if>
<#-- -------------------------------------------------------------------------------------------------------- -->
© 2015 - 2025 Weber Informatics LLC | Privacy Policy