Mongodb – optimize mongo query to get max date in a very short time
I'm using the query bellow to get max date (field named extractionDate) in a collection called KPI, and since I'm only interested in the field extractionDate: @Override public Mono<DBObject> getLastExtractionDate(MatchOperation matchOperation,ProjectionOperation projectionOperation) { return Mono.from(mongoTemplate.aggregate( newAggregation( matchOperation, projectionOperation, group().max(EXTRACTION_DATE).as("result"), project().andExclude("_id")…