public final class Aggregates
extends java.lang.Object
| 限定符和类型 | 方法和说明 |
|---|---|
static <TExpression> |
group(TExpression id,
BsonField... fieldAccumulators)
Creates a $group pipeline stage for the specified filter
|
static <TExpression> |
group(TExpression id,
java.util.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(java.lang.String from,
java.lang.String localField,
java.lang.String foreignField,
java.lang.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(java.lang.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(java.lang.String fieldName)
Creates a $unwind pipeline stage for the specified field name, which must be prefixed by a
'$' sign. |
static Bson |
unwind(java.lang.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 projectionProjectionspublic 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(java.lang.String from, java.lang.String localField, java.lang.String foreignField, java.lang.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, java.util.List<BsonField> fieldAccumulators)
TExpression - the expression typeid - the id expression for the groupfieldAccumulators - zero or more field accumulator pairspublic static Bson unwind(java.lang.String fieldName)
'$' sign.fieldName - the field name, prefixed by a '$' signpublic static Bson unwind(java.lang.String fieldName, UnwindOptions unwindOptions)
'$' sign.public static Bson out(java.lang.String collectionName)