public final class Aggregates extends Object
Modifier and Type | Method and Description |
---|---|
static <TExpression> |
group(TExpression id,
BsonField... fieldAccumulators)
Creates a $group pipeline stage for the specified filter
|
static <TExpression> |
group(TExpression id,
List<BsonField> fieldAccumulators)
Creates a $group pipeline stage for the specified filter
|
static Bson |
limit(int limit)
Creates a $limit pipeline stage for the specified filter
|
static Bson |
lookup(String from,
String localField,
String foreignField,
String as)
Creates a $lookup pipeline stage for the specified filter
|
static Bson |
match(Bson filter)
Creates a $match pipeline stage for the specified filter
|
static Bson |
out(String collectionName)
Creates a $out pipeline stage for the specified filter
|
static Bson |
project(Bson projection)
Creates a $project pipeline stage for the specified projection
|
static Bson |
sample(int size)
Creates a $sample pipeline stage with the specified sample size
|
static Bson |
skip(int skip)
Creates a $skip pipeline stage
|
static Bson |
sort(Bson sort)
Creates a $sort pipeline stage for the specified sort specification
|
static Bson |
unwind(String fieldName)
Creates a $unwind pipeline stage for the specified field name, which must be prefixed by a
'$' sign. |
static Bson |
unwind(String fieldName,
UnwindOptions unwindOptions)
Creates a $unwind pipeline stage for the specified field name, which must be prefixed by a
'$' sign. |
public static Bson match(Bson filter)
public static Bson project(Bson projection)
projection
- the projectionProjections
public static Bson sort(Bson sort)
public static Bson skip(int skip)
skip
- the number of documents to skippublic static Bson limit(int limit)
limit
- the limitpublic static Bson lookup(String from, String localField, String foreignField, String as)
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.as
- the name of the new array field to add to the input documents.public static <TExpression> Bson group(TExpression id, BsonField... fieldAccumulators)
TExpression
- the expression typeid
- the id expression for the groupfieldAccumulators
- zero or more field accumulator pairspublic static <TExpression> Bson group(TExpression id, List<BsonField> fieldAccumulators)
TExpression
- the expression typeid
- the id expression for the groupfieldAccumulators
- zero or more field accumulator pairspublic static Bson unwind(String fieldName)
'$'
sign.fieldName
- the field name, prefixed by a '$' sign
public static Bson unwind(String fieldName, UnwindOptions unwindOptions)
'$'
sign.public static Bson out(String collectionName)