Skip to content

Interface AggregationExpression in package org.springframework.data.mongodb.core.aggregation should be public [DATAMONGO-1492] #2406

Closed
@spring-projects-issues

Description

@spring-projects-issues

Marco Papini opened DATAMONGO-1492 and commented

When new features of MongoDb are released, it takes sometime to add support for them to SpringData Mongo.

As an example MongoDb 3.2 introduced $filter operator to work on array subdocument (https://docs.mongodb.com/manual/reference/operator/aggregation/filter/#exp._S_filter).

If the interface is public that can be legit:

ProjectionOperation agg = Aggregation.project() //

      .and(new AggregationExpression() {

        @Override
        public DBObject toDbObject(AggregationOperationContext context) {

          DBObject filterExpression = new BasicDBObject();
          filterExpression.put("input", "$answer_list");
          filterExpression.put("as", "answer");
          filterExpression.put("cond", new BasicDBObject("$eq2", Arrays.<Object> asList("$$answer.question", 2)));

          return new BasicDBObject("$filter", filterExpression);
        }
      }).as("profile");

Affects: 1.9.3 (Hopper SR3)

Referenced from: pull request #392

Backported to: 1.9.3 (Hopper SR3), 1.8.5 (Gosling SR5)

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions