Skip to content
广告❤️成为赞助商

管道函数构造器

使用MongoPlus快速构建管道条件,构造器为每个阶段都提供了非常丰富的功能,构建管道无比丝滑

说明:

  • 管道构建示例请查看:https://gitee.com/aizuda/mongo-plus/tree/master/mongo-plus-aggregate
  • 由于管道构造器方法很多,文档中不会提供方法和参数注释,只提供构造器支持的阶段,不过可以通过点进方法源码查看注释
  • 下列管道函数中,参数为BasicDBObject和Bson的,为自定义条件,可以自己构建管道参数,包括custom方法

addFields

java
addFields(final String field,final String value);
addFields(final SFunction<T,?> field,final String value);
addFields(final String value,final SFunction<T,?>... field);
addFields(final SFunction<T,?> field,final Object value);
addFields(final SFunction<T,?> field, final Collection<?> value);
addFields(final String field, final Collection<?> value);
addFields(final Field<?>... fields);
addFields(final List<Field<?>> fields);
addFields(final Bson bson);

set

java
set(final String field,final String value);
set(final SFunction<T,?> field,final String value);
set(final String value,final SFunction<T,?>... field);
set(final SFunction<T,?> field,final Object value);
set(final SFunction<T,?> field, final Collection<?> value);
set(final String field, final Collection<?> value);
set(final Field<?>... fields);
set(final List<Field<?>> fields);
set(final Bson bson);

bucket

java
bucket(final SFunction<T,?> groupBy,final List<Boundary> boundaries);
bucket(final Object groupBy,final List<Boundary> boundaries);
bucket(final SFunction<T,?> groupBy, final List<Boundary> boundaries, BucketOptions options);
bucket(final Object groupBy, final List<Boundary> boundaries, BucketOptions options);
bucket(final Bson bson);

bucketAuto

java
bucketAuto(final SFunction<T,?> groupBy,final Integer buckets);
bucketAuto(final Object groupBy,final Integer buckets);
bucketAuto(final SFunction<T,?> groupBy, final Integer buckets, BucketAutoOptions options);
bucketAuto(final Object groupBy, final Integer buckets, BucketAutoOptions options);
bucketAuto(final Bson bson);

count

java
count();
count(final SFunction<T,?> field);

match

java
match(final QueryChainWrapper<?, ?> queryChainWrapper);
match(final SFunction<QueryChainWrapper<?,?>,QueryChainWrapper<?,?>> function);
match(final Bson bson);

project

java
projectDisplay(SFunction<T,R>... column);
projectDisplay(String... column);
projectNone(SFunction<T,R>... column);
projectNone(String... column);
project(boolean displayId, Projection... projection);
project(Projection... projection);
project(boolean displayId, Collection<? extends Projection> projection);
project(Collection<? extends Projection> projection);
projectDisplay(boolean displayId,SFunction<T,R>... column);
projectDisplay(boolean displayId,String... column);
projectNone(boolean displayId,SFunction<T,R>... column);
projectNone(boolean displayId,String... column);
project(final Bson bson);

sort

java
sort(final String field, final Integer value);
sort(final SFunction<T,?> field,final Integer value);
sortAsc(final SFunction<T,?> field);
sortAsc(final String field);
sortAsc(final SFunction<T, ?>... field);
sortAsc(final String... field);
sortAscLambda(final List<SFunction<T,?>> field);
sortAsc(final List<String> field);
sortDesc(final SFunction<T,?> field);
sortDesc(final String field);
sortDesc(final SFunction<T, ?>... field);
sortDesc(final String... field);
sortDescLambda(final List<SFunction<T,?>> field);
sortDesc(final List<String> field);
metaTextScore(final String field);
metaTextScore(final SFunction<T,?> field);
sort(final Bson bson);

sortByCount

java
sortByCount(final String field);
sortByCount(final SFunction<T,?> field);

skip

java
skip(final long skip);
skip(final int skip);

limit

java
limit(final long limit);
limit(final int limit);

lookup

java
lookup(final String from,final String localField,final String foreignField,final String as);
lookup(final String from,final SFunction<T,?> localField,final SFunction<R,?> foreignField, final String as);
lookup(final String from,final SFunction<T,?> localField,final String foreignField,final String as);
lookup(final String from,final String localField,final SFunction<T,?> foreignField,final String as);
lookup(final String from, final List<Variable<TExpression>> letList,final Aggregate<?> aggregate, final String as);
lookup(final String from, final Aggregate<?> aggregate, final String as);
lookup(final Bson bson);

facet

java
facet(final String name, final Bson... pipeline);
facet(final String name, final List<? extends Bson> pipeline);
facet(final String name, final Aggregate<?> aggregate);
facet(final Facet... facets);
facet(final List<Facet> facets);
facet(final Bson bson);

graphLookup

java
graphLookup(final String from, final Object startWith, final String connectFromField,final String connectToField, final String as);
graphLookup(final String from, final SFunction<T,?> startWith, final SFunction<R,?> connectFromField,final SFunction<U,?> connectToField, final String as);
graphLookup(final String from, final Object startWith, final SFunction<T,?> connectFromField,final SFunction<R,?> connectToField, final String as);
graphLookup(final String from, final Object startWith, final String connectFromField,final String connectToField, final String as, final GraphLookupOptions options);
graphLookup(final String from, final SFunction<T,?> startWith, final SFunction<R,?> connectFromField,final SFunction<U,?> connectToField, final String as, final GraphLookupOptions options);
graphLookup(final String from, final Object startWith, final SFunction<T,?> connectFromField,final SFunction<R,?> connectToField, final String as, final GraphLookupOptions options);
graphLookup(final Bson bson);

group

java
group(final String _id);
group(final SFunction<T,?> _id);
group(@Nullable final TExpression id, final BsonField... fieldAccumulators);
group(@Nullable final SFunction<T,?> id, final BsonField... fieldAccumulators);
group(@Nullable final TExpression id, final List<BsonField> fieldAccumulators);
group(@Nullable final SFunction<T,?> id, final List<BsonField> fieldAccumulators);
group(final Bson bson);

unionWith

java
unionWith(final String collectionName);
unionWith(final Class<?> collection);
unionWith(final String collectionName,final Aggregate<?> aggregate);
unionWith(final String collectionName,final List<? extends Bson> aggregate);
unionWith(final Class<?> collection,final Aggregate<?> aggregate);
unionWith(final Class<?> collection,final List<? extends Bson> aggregate);
unionWith(final Bson bson);

unwind

java
unwind(final String fieldName);
unwind(final SFunction<T,?> fieldName);
unwind(final String fieldName, final UnwindOption unwindOption);
unwind(final SFunction<T,?> fieldName,final UnwindOption unwindOption);
unwind(final Bson bson);

out

java
out(final String collectionName);
out(final Class<?> collection);
out(final String databaseName, final String collectionName);
out(final Bson bson);

merge

java
merge(final String collectionName);
merge(final Class<?> collection);
merge(final MongoNamespace namespace);
merge(final String collectionName, final MergeOptions options);
merge(final Class<?> collection, final MergeOptions options);
merge(final MongoNamespace namespace, final MergeOptions options);
merge(final Bson bson);

replaceRoot

java
replaceRoot(final TExpression fieldName);
replaceRoot(final Document value);
replaceRoot(final SFunction<T,?> fieldName);
replaceRoot(final Bson bson);

replaceWith

java
replaceWith(final TExpression fieldName);
replaceWith(final Document value);
replaceWith(final SFunction<T,?> fieldName);
replaceWith(final Bson bson);

sample

java
sample(final Number size);
sample(final Bson bson);

setWindowFields

java
setWindowFields(@Nullable final TExpression partitionBy, @Nullable final Bson sortBy,final WindowOutputField output, final WindowOutputField... moreOutput);
setWindowFields(@Nullable final TExpression partitionBy, @Nullable final Bson sortBy,final Iterable<? extends WindowOutputField> output);
setWindowFields(Bson bson);

densify

java
densify(final String field, final DensifyRange range);
densify(final SFunction<T,?> field, final DensifyRange range);
densify(final String field, final DensifyRange range, final DensifyOptions options);
densify(final SFunction<T,?> field, final DensifyRange range, final DensifyOptions options);
densify(final Bson bson);

fill

java
fill(final FillOptions options, final FillOutputField output, final FillOutputField... moreOutput);
fill(final FillOptions options, final Iterable<? extends FillOutputField> output);
fill(final Bson bson);

unset

java
unset(final String... field);
unset(final SFunction<T,?>... field);
unset(final List<String> fields);
unsetLambda(final List<SFunction<T,?>> fields);
unset(final Bson bson);

custom

java
custom(final Bson bson);