All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ftl.data.mongo.method.$$MongoRepositoryCountDocumentsMethodBodyTemplateftl Maven / Gradle / Ivy

There is a newer version: 0.11
Show newest version
<#include "../mongo-lib.javaftl">
<#-- -------------------------------------------------------------------------------------------------------- -->
<#if QUERY??>
${createBsonVar('query', QUERY)}

<#if HINT??>
${createBsonVar('hint', HINT)}

<#-- -------------------------------------------------------------------------------------------------------- -->
<#if HINT?? || LIMIT?? || SKIP??>
final Publisher result = collection
        .countDocuments(<#if QUERY??>query, <#else>MongoQueries.NULL, new CountOptions()
<#if HINT??>
                .hint(hint)

<#if LIMIT??>
                .limit(${LIMIT})

<#if SKIP??>
                .skip(${SKIP})

        );
<#else>
final Publisher result = collection
        .countDocuments(<#if QUERY??>query);

<#-- -------------------------------------------------------------------------------------------------------- -->
<#-- -------------------------------------------------------------------------------------------------------- -->
<#-- -------------------------------------------------------------------------------------------------------- -->
<#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";

<#-- -------------------------------------------------------------------------------------------------------- -->




© 2015 - 2025 Weber Informatics LLC | Privacy Policy