diff --git a/dsl/src/commonMain/kotlin/aggregation/accumulators/ArithmeticValueAccumulators.kt b/dsl/src/commonMain/kotlin/aggregation/accumulators/ArithmeticValueAccumulators.kt index e88b009e..a20cc1b8 100644 --- a/dsl/src/commonMain/kotlin/aggregation/accumulators/ArithmeticValueAccumulators.kt +++ b/dsl/src/commonMain/kotlin/aggregation/accumulators/ArithmeticValueAccumulators.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, OpenSavvy and contributors. + * Copyright (c) 2025-2026, OpenSavvy and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -67,7 +67,7 @@ interface ArithmeticValueAccumulators : ValueAccumulator @OptIn(DangerousMongoApi::class, LowLevelApi::class) @Suppress("INVISIBLE_REFERENCE") @KtMongoDsl - infix fun <@kotlin.internal.OnlyInputTypes T : Number> Field.sum(value: Value) { + infix fun <@kotlin.internal.OnlyInputTypes T : Number> Field.sum(value: Value) { accept(ArithmeticValueAccumulator("\$sum", value, this.path, context)) } @@ -99,12 +99,12 @@ interface ArithmeticValueAccumulators : ValueAccumulator */ @Suppress("INVISIBLE_REFERENCE") @KtMongoDsl - infix fun <@kotlin.internal.OnlyInputTypes T : Number> KProperty1.sum(value: Value) { + infix fun <@kotlin.internal.OnlyInputTypes T : Number> KProperty1.sum(value: Value) { this.field.sum(value) } // endregion - // region $sum + // region $avg /** * Calculates and returns the collective average of numeric values. @@ -137,7 +137,7 @@ interface ArithmeticValueAccumulators : ValueAccumulator @OptIn(DangerousMongoApi::class, LowLevelApi::class) @Suppress("INVISIBLE_REFERENCE") @KtMongoDsl - infix fun <@kotlin.internal.OnlyInputTypes T : Number> Field.average(value: Value) { + infix fun <@kotlin.internal.OnlyInputTypes T : Number> Field.average(value: Value) { accept(ArithmeticValueAccumulator("\$avg", value, this.path, context)) } @@ -171,7 +171,7 @@ interface ArithmeticValueAccumulators : ValueAccumulator */ @Suppress("INVISIBLE_REFERENCE") @KtMongoDsl - infix fun <@kotlin.internal.OnlyInputTypes T : Number> KProperty1.average(value: Value) { + infix fun <@kotlin.internal.OnlyInputTypes T : Number> KProperty1.average(value: Value) { this.field.average(value) }