本文整理了Java中com.mongodb.client.model.Aggregates.skip()
方法的一些代码示例,展示了Aggregates.skip()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Aggregates.skip()
方法的具体详情如下:
包路径:com.mongodb.client.model.Aggregates
类名称:Aggregates
方法名:skip
[英]Creates a $skip pipeline stage
[中]创建$skip管道阶段
代码示例来源:origin: eclipse/ditto
private static void addSkipAndLimit(final Collection<Bson> pipeline,
final int skip,
final int limit,
final boolean isCount) {
if (!isCount) {
pipeline.add(Aggregates.skip(skip));
pipeline.add(Aggregates.limit(limit + 1));
}
}
代码示例来源:origin: org.eclipse.ditto/ditto-services-thingsearch-persistence
private static void addSkipAndLimit(final Collection<Bson> pipeline,
final int skip,
final int limit,
final boolean isCount) {
if (!isCount) {
pipeline.add(Aggregates.skip(skip));
pipeline.add(Aggregates.limit(limit + 1));
}
}
代码示例来源:origin: org.opencb.commons/commons-datastore-mongodb
public static Bson getSkip(QueryOptions options) {
if (options.getInt(QueryOptions.SKIP) > 0) {
return Aggregates.skip(options.getInt(QueryOptions.SKIP));
}
return null;
}
代码示例来源:origin: T-baby/MongoDB-Plugin
public MongoAggregation(MongoQuery query) {
/*复用MongoQuery*/
this.query = query;
if (query.getQuery() != null && !query.getQuery().isEmpty()) {
pipeline.add(Aggregates.match(Filters.and(query.getQuery())));
}
if (query.getSort() != null) {
pipeline.add(Aggregates.sort(query.getSort()));
}
if (query.getSkip() > 0) {
pipeline.add(Aggregates.skip(query.getSkip()));
}
if (query.getLimit() > 0) {
pipeline.add(Aggregates.limit(query.getLimit()));
}
}
代码示例来源:origin: ozlerhakan/mongolastic
/**
* Get the MongoDB cursor.
*/
private MongoCursor<Document> getCursor(int skip) {
if (cursor == null && cursorId == 0) {
Document query = Document.parse(config.getMongo().getQuery());
List<Bson> pipes = new ArrayList<>(3);
pipes.add(match(query));
pipes.add(skip(skip));
Optional.ofNullable(config.getMongo().getProject()).ifPresent(p -> pipes.add(project(Document.parse(p))));
AggregateIterable<Document> aggregate = collection.aggregate(pipes)
.allowDiskUse(true)
.useCursor(true);
cursor = aggregate.iterator();
// TODO: Persist cursor ID somewhere to allow restarts.
Optional.ofNullable(cursor.getServerCursor()).ifPresent(serverCursor -> cursorId = serverCursor.getId());
} else if (cursor == null && cursorId != 0) {
// TODO: Lookup cursor ID for resume.
// Open existing cursor in case of restart??
}
return cursor;
}
}
代码示例来源:origin: com.cybermkd/MongodbPlugin
public MongoAggregation(MongoQuery query) {
/*复用MongoQuery*/
this.query = query;
if (query.getQuery() != null && !query.getQuery().isEmpty()) {
pipeline.add(Aggregates.match(Filters.and(query.getQuery())));
}
if (query.getSort() != null) {
pipeline.add(Aggregates.sort(query.getSort()));
}
if (query.getSkip() > 0) {
pipeline.add(Aggregates.skip(query.getSkip()));
}
if (query.getLimit() > 0) {
pipeline.add(Aggregates.limit(query.getLimit()));
}
}
代码示例来源:origin: com.holon-platform.mongo/holon-datastore-mongo-core
definition.getOffset().ifPresent(o -> pipeline.add(Aggregates.skip(o)));
内容来源于网络,如有侵权,请联系作者删除!