Fix signature of Aggregates.lookup overload.
The signature of the lookup method with a parameter for "let" is
incorrect.  Instead of
List<Variable<?>>
it should be
List<Variable<TExpression>>
where TExpression is a method-level type parameter. Otherwise, the only
value you can pass to it is null.
@@ -266,6 +266,7 @@ public final class Aggregates {
/**
* Creates a $lookup pipeline stage, joining the current collection with the one specified in from using the given pipeline
*
+ * @param <TExpression> the Variable value expression type
* @param from the name of the collection in the same database to perform the join with.
* @param let the variables to use in the pipeline field stages.
* @param pipeline the pipeline to run on the joined collection.
@@ -275,9 +276,9 @@ public final class Aggregates {
* @mongodb.server.release 3.6
* @since 3.7
*/
- public static Bson lookup(final String from, @Nullable final List<Variable<?>> let, final List<? extends Bson> pipeline,
- final String as) {
- return new LookupStage(from, let, pipeline, as);
+ public static <TExpression> Bson lookup(final String from, @Nullable final List<Variable<TExpression>> let,
+ final List<? extends Bson> pipeline, final String as) {
+ return new LookupStage<TExpression>(from, let, pipeline, as);
}
/**
@@ -583,13 +584,13 @@ public final class Aggregates {
}
}
- private static final class LookupStage implements Bson {
+ private static final class LookupStage<TExpression> implements Bson {
private final String from;
- private final List<Variable<?>> let;
+ private final List<Variable<TExpression>> let;
private final List<? extends Bson> pipeline;
private final String as;
- private LookupStage(final String from, @Nullable final List<Variable<?>> let, final List<? extends Bson> pipeline,
+ private LookupStage(final String from, @Nullable final List<Variable<TExpression>> let, final List<? extends Bson> pipeline,
final String as) {
this.from = from;
this.let = let;
