Skip to content

Commit f053bed

Browse files
christophstroblmp911de
authored andcommitted
DATAMONGO-1492 - Make o.s.d.m.core.aggregation.AggregationExpression public.
By turning `AggregationExpression` public we allow adding custom expressions without workarounds. It is now possible to create eg. `ProjectionOperation` like: ProjectionOperation agg = Aggregation.project() .and(new AggregationExpression() { @OverRide public DBObject toDbObject(AggregationOperationContext context) { DBObject filterExpression = new BasicDBObject(); filterExpression.put("input", "$x"); filterExpression.put("as", "y"); filterExpression.put("cond", new BasicDBObject("$eq", Arrays.<Object> asList("$$y.z", 2))); return new BasicDBObject("$filter", filterExpression); } }).as("profile"); Original pull request: #392.
1 parent 1a1cd9e commit f053bed

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationExpression.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015 the original author or authors.
2+
* Copyright 2015-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,16 +20,17 @@
2020
/**
2121
* An {@link AggregationExpression} can be used with field expressions in aggregation pipeline stages like
2222
* {@code project} and {@code group}.
23-
*
23+
*
2424
* @author Thomas Darimont
2525
* @author Oliver Gierke
26+
* @author Christoph Strobl
2627
*/
27-
interface AggregationExpression {
28+
public interface AggregationExpression {
2829

2930
/**
3031
* Turns the {@link AggregationExpression} into a {@link DBObject} within the given
3132
* {@link AggregationOperationContext}.
32-
*
33+
*
3334
* @param context
3435
* @return
3536
*/

0 commit comments

Comments
 (0)