DMITRY.
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")
ephemient
Commit::class.java
inline fun <reified O> MongoOperations.aggregate(aggretation: Aggregation, name: String): AggregationResults<O> = aggregate(aggregation, name, O::class.java)
.aggregate<Commit>(aggregation, "commit")
A modern programming language that makes developers happier.