public class AggregatesKt
@NotNull
public static org.bson.conversions.Bson addFields(@NotNull
com.mongodb.client.model.Field... fields)
Creates an $addFields pipeline stage
fields - the fields to add@NotNull
public static org.bson.conversions.Bson addFields(@NotNull
java.util.List<? extends com.mongodb.client.model.Field<?>> fields)
Creates an $addFields pipeline stage
fields - the fields to add@NotNull
public static <TExpression,Boundary> org.bson.conversions.Bson bucket(TExpression groupBy,
@NotNull
java.util.List<? extends Boundary> boundaries,
@NotNull
com.mongodb.client.model.BucketOptions options)
Creates a $bucket pipeline stage
groupBy - the criteria to group Byboundaries - the boundaries of the bucketsoptions - the optional values for the $bucket stage@NotNull
public static <TExpression> org.bson.conversions.Bson bucketAuto(TExpression groupBy,
int buckets,
@NotNull
com.mongodb.client.model.BucketAutoOptions options)
Creates a $bucketAuto pipeline stage
groupBy - the criteria to group Bybuckets - the number of the bucketsoptions - the optional values for the $bucketAuto stage@NotNull
public static <T> org.bson.conversions.Bson count(@NotNull
kotlin.reflect.KProperty<? extends T> $this$count)
Creates a $count pipeline stage using the named field to store the result
@NotNull
public static org.bson.conversions.Bson match(@NotNull
org.bson.conversions.Bson filter)
Creates a $match pipeline stage for the specified filter
filter - the filter to match@NotNull
public static org.bson.conversions.Bson match(@NotNull
org.bson.conversions.Bson... filters)
Creates a $match pipeline stage with $and on each filter.
@NotNull
public static org.bson.conversions.Bson document(@NotNull
org.bson.conversions.Bson... elements)
Produce a bson document with the specified elements.
elements - the element of the document (key:value)@NotNull
public static org.bson.conversions.Bson document(@NotNull
java.util.Collection<? extends org.bson.conversions.Bson> elements)
Produce a bson document with the specified elements.
elements - the element of the document (key:value)@NotNull
public static org.bson.conversions.Bson project(@NotNull
org.bson.conversions.Bson projection)
Creates a $project pipeline stage for the specified getProjection
projection - the getProjection@NotNull
public static org.bson.conversions.Bson project(@NotNull
kotlin.reflect.KProperty... properties)
Creates a $project pipeline stage for all specified properties
properties - the properties to project@NotNull
public static org.bson.conversions.Bson project(@NotNull
kotlin.Pair... properties)
Creates a $project pipeline stage for all specified properties
properties - the properties to project@NotNull
public static org.bson.conversions.Bson project(@NotNull
org.bson.conversions.Bson... projections)
Creates a $project pipeline stage for all specified properties
projections - the properties to project@NotNull
public static org.bson.conversions.Bson project(@NotNull
java.util.Map<? extends kotlin.reflect.KProperty<?>,? extends java.lang.Object> properties)
Creates a $project pipeline stage for all specified properties
properties - the properties to project@NotNull
public static org.bson.conversions.Bson sort(@NotNull
org.bson.conversions.Bson sort)
Creates a $sort pipeline stage for the specified sort specification
sort - the sort specification@NotNull public static <TExpression> org.bson.conversions.Bson sortByCount(TExpression filter)
Creates a $sortByCount pipeline stage for the specified filter
filter - the filter specification@NotNull public static org.bson.conversions.Bson skip(int skip)
Creates a $skip pipeline stage
skip - the number of documents to skip@NotNull public static org.bson.conversions.Bson limit(int limit)
Creates a $limit pipeline stage for the specified filter
limit - the limit@NotNull
public static org.bson.conversions.Bson lookup(@NotNull
java.lang.String from,
@NotNull
java.lang.String localField,
@NotNull
java.lang.String foreignField,
@NotNull
java.lang.String newAs)
Creates a $lookup pipeline stage for the specified filter
from - the name of the collection in the same database to perform the join with.localField - specifies the field from the local collection to match values against.foreignField - specifies the field in the from collection to match values against.newAs - the name of the new array field to add to the input documents.@NotNull
public static org.bson.conversions.Bson facet(@NotNull
java.util.List<? extends com.mongodb.client.model.Facet> facets)
Creates a facet pipeline stage
facets - the facets to use@NotNull
public static org.bson.conversions.Bson facet(@NotNull
com.mongodb.client.model.Facet... facets)
Creates a facet pipeline stage
facets - the facets to use@NotNull
public static <TExpression> org.bson.conversions.Bson graphLookup(@NotNull
java.lang.String from,
TExpression startWith,
@NotNull
java.lang.String connectFromField,
@NotNull
java.lang.String connectToField,
@NotNull
java.lang.String fieldAs,
@NotNull
com.mongodb.client.model.GraphLookupOptions options)
Creates a graphLookup pipeline stage for the specified filter
from - the collection to querystartWith - the expression to start the graph lookup withconnectFromField - the from fieldconnectToField - the to fieldfieldAs - name of field in output documentoptions - optional values for the graphLookup@NotNull
public static <TExpression> org.bson.conversions.Bson group(TExpression id,
@NotNull
com.mongodb.client.model.BsonField... fieldAccumulators)
Creates a $group pipeline stage for the specified filter
id - the id expression for the groupfieldAccumulators - zero or more field accumulator pairs@NotNull
public static <TExpression> org.bson.conversions.Bson group(TExpression id,
@NotNull
java.util.List<com.mongodb.client.model.BsonField> fieldAccumulators)
Creates a $group pipeline stage for the specified filter
id - the id expression for the groupfieldAccumulators - zero or more field accumulator pairs@NotNull
public static org.bson.conversions.Bson unwind(@NotNull
java.lang.String fieldName,
@NotNull
com.mongodb.client.model.UnwindOptions unwindOptions)
Creates a $unwind pipeline stage for the specified field name, which must be prefixed by a '$' sign.
fieldName - the field name, prefixed by a '$' signunwindOptions - options for the unwind pipeline stage@NotNull
public static <T> org.bson.conversions.Bson unwind(@NotNull
kotlin.reflect.KProperty<? extends T> $this$unwind,
@NotNull
com.mongodb.client.model.UnwindOptions unwindOptions)
Creates a $unwind pipeline stage for the specified field name, which must be prefixed by a '$' sign.
unwindOptions - options for the unwind pipeline stage@NotNull
public static org.bson.conversions.Bson out(@NotNull
java.lang.String collectionName)
Creates a $out pipeline stage for the specified filter
collectionName - the collection name@NotNull public static <TExpression> org.bson.conversions.Bson replaceRoot(TExpression value)
Creates a $replaceRoot pipeline stage
value - the new root value@NotNull public static org.bson.conversions.Bson sample(int size)
Creates a $sample pipeline stage with the specified sample size
size - the sample size@NotNull
public static <BooleanExpression,ThenExpression,ElseExpression> org.bson.conversions.Bson cond(@NotNull
BooleanExpression booleanExpression,
@NotNull
ThenExpression thenExpression,
@NotNull
ElseExpression elseExpression)
Returns a $cond expression.
booleanExpression - the boolean expressionthenExpression - the then expressionelseExpression - the else expression@NotNull
public static org.bson.conversions.Bson dayOfYear(@NotNull
kotlin.reflect.KProperty<? extends java.time.temporal.TemporalAccessor> property)
Builds $dayOfYear expression for this property .
@NotNull
public static org.bson.conversions.Bson dayOfMonth(@NotNull
kotlin.reflect.KProperty<? extends java.time.temporal.TemporalAccessor> property)
Builds $dayOfMonth expression for this property .
@NotNull
public static org.bson.conversions.Bson dayOfWeek(@NotNull
kotlin.reflect.KProperty<? extends java.time.temporal.TemporalAccessor> property)
Builds $dayOfWeek expression for this property .
@NotNull
public static org.bson.conversions.Bson year(@NotNull
kotlin.reflect.KProperty<? extends java.time.temporal.TemporalAccessor> property)
Builds $year expression for this property .
@NotNull
public static org.bson.conversions.Bson hour(@NotNull
kotlin.reflect.KProperty<? extends java.time.temporal.TemporalAccessor> property)
Builds $hour expression for this property .
@NotNull
public static org.bson.conversions.Bson millisecond(@NotNull
kotlin.reflect.KProperty<? extends java.time.temporal.TemporalAccessor> property)
Builds $millisecond expression for this property .
@NotNull
public static org.bson.conversions.Bson minute(@NotNull
kotlin.reflect.KProperty<? extends java.time.temporal.TemporalAccessor> property)
Builds $minute expression for this property .
@NotNull
public static org.bson.conversions.Bson month(@NotNull
kotlin.reflect.KProperty<? extends java.time.temporal.TemporalAccessor> property)
Builds $month expression for this property .
@NotNull
public static org.bson.conversions.Bson second(@NotNull
kotlin.reflect.KProperty<? extends java.time.temporal.TemporalAccessor> property)
Builds $second expression for this property .
@NotNull
public static org.bson.conversions.Bson week(@NotNull
kotlin.reflect.KProperty<? extends java.time.temporal.TemporalAccessor> property)
Builds $week expression for this property .
@NotNull
public static org.bson.conversions.Bson lookup(@NotNull
java.lang.String from,
@Nullable
java.util.List<? extends com.mongodb.client.model.Variable<? extends java.lang.Object>> let,
@NotNull
kotlin.reflect.KProperty<? extends java.lang.Object> resultProperty,
@NotNull
org.bson.conversions.Bson... pipeline)
Creates a $lookup pipeline stage, joining the current collection with the one specified in from using the given pipeline
from - the name of the collection in the same database to perform the join with.let - the variables to use in the pipeline field stages.resultProperty - the name of the new array field to add to the input documents.pipeline - the pipeline to run on the joined collection.@NotNull
public static com.mongodb.client.model.Variable<java.lang.String> variableDefinition(@NotNull
kotlin.reflect.KProperty<?> $this$variableDefinition,
@NotNull
java.lang.String name)
Defines a Variable for the lookup operator.
@NotNull
public static java.lang.String getVariable(@NotNull
kotlin.reflect.KProperty<?> $this$variable)
Defines a Variable projection (ie $$name)