``` val aggregation = Aggregation.newAggreg...
# getting-started
d
Copy code
val aggregation = Aggregation.newAggregation(Aggregation.sample(1))
        val commit = mongoOperations.aggregate(aggregation, "commit", Commit::class.java).uniqueMappedResult
        commit?.message
            ?.let { return ResponseEntity<String>(commit.message, HttpStatus.OK) }
            ?: throw ResponseStatusException(HttpStatus.NOT_FOUND, "Unable to find commit")
Does that look like the Kotlin way?
e
the
Commit::class.java
bit looks the least Kotlin-like
understandable if that's the API you have to deal with, but a wrapper like
Copy code
inline fun <reified O> MongoOperations.aggregate(aggretation: Aggregation, name: String): AggregationResults<O> =
    aggregate(aggregation, name, O::class.java)
would let you write
.aggregate<Commit>(aggregation, "commit")
in Kotlin
although if the API is Java... might run into annoyances like https://youtrack.jetbrains.com/issue/KT-11968