Skip to content

Incorrect name of derived fields in group aperation after project operation. [DATAMONGO-1359] #2256

Open
@spring-projects-issues

Description

@spring-projects-issues

Francisco José Cadaval Arrola opened DATAMONGO-1359 and commented

When I project field "measures.max" as "max" in a projection operation and after it I try to get maximun of it in a group operation, the group operation establish the max over "$measures.max" instead of "$max".

Width this code:

List<AggregationOperation> list = new ArrayList<AggregationOperation>();
		
ProjectionOperation projection = Aggregation.project("reference").and("measures.max").as("max");
GroupOperation group = Aggregation.group("reference").max("max").as("max");
		
list.add(projection);
list.add(group);
		
Aggregation aggregation = Aggregation.newAggregation(list);

The aggregation is:

{ "aggregate" : "__collection__" , "pipeline" : [
    { "$project" : { "reference" : 1 , "max" : "$measures.max"}} ,
    { "$group" : { "_id" : "$reference" , "max" : { "$max" : "$measures.max"}}}
]}

while it should be:

{ "aggregate" : "__collection__" , "pipeline" : [
    { "$project" : { "reference" : 1 , "max" : "$measures.max"}} ,
    { "$group" : { "_id" : "$reference" , "max" : { "$max" : "$max"}}}
]}

It is similar to DATAMONGO-1254


Affects: 1.8.4 (Gosling SR4)

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions