当前位置: 首页>>代码示例>>Java>>正文


Java BsonField类代码示例

本文整理汇总了Java中com.mongodb.client.model.BsonField的典型用法代码示例。如果您正苦于以下问题:Java BsonField类的具体用法?Java BsonField怎么用?Java BsonField使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BsonField类属于com.mongodb.client.model包,在下文中一共展示了BsonField类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getServerQuery

import com.mongodb.client.model.BsonField; //导入依赖的package包/类
private static List<Bson> getServerQuery(Bson filter) {

    final List<Bson> pipeline = new ArrayList<>(6);
    if (filter != ALL) {
      pipeline.add(Aggregates.match(filter));
    }
    pipeline.add(Aggregates.unwind("$deployments", new UnwindOptions().preserveNullAndEmptyArrays(true)));
    pipeline.add(Aggregates.lookup(Collections.APPLICATIONS, "deployments.applicationId", "id", "applications"));
    pipeline.add(Aggregates.unwind("$applications", new UnwindOptions().preserveNullAndEmptyArrays(true)));
    pipeline.add(Aggregates.group(
      new Document().append("hostname", "$hostname").append("environment", "$environment"),
      new BsonField("fqdn", new Document("$first", "$fqdn")),
      new BsonField("description", new Document("$first", "$description")),
      new BsonField("os", new Document("$first", "$os")),
      new BsonField("network", new Document("$first", "$network")),
      new BsonField("meta", new Document("$first", "$meta")),
      new BsonField("attributes", new Document("$first", "$attributes")),
      new BsonField("applications", new Document("$push", "$applications")),
      new BsonField("deployments", new Document("$push", "$deployments"))));
    pipeline.add(Aggregates.sort(Sorts.ascending("_id")));
    return pipeline;
  }
 
开发者ID:atgse,项目名称:sam,代码行数:23,代码来源:ServerResource.java

示例2: distinct

import com.mongodb.client.model.BsonField; //导入依赖的package包/类
/**
 * Add a $group step to filter out redundant solutions.
 * @return True if the distinct operation was successfully appended.
 */
public boolean distinct() {
    List<String> key = new LinkedList<>();
    for (String varName : bindingNames) {
        key.add(hashFieldExpr(varName));
    }
    List<BsonField> reduceOps = new LinkedList<>();
    for (String field : FIELDS) {
        reduceOps.add(new BsonField(field, new Document("$first", "$" + field)));
    }
    pipeline.add(Aggregates.group(new Document("$concat", key), reduceOps));
    return true;
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:17,代码来源:AggregationPipelineQueryNode.java

示例3: getAccumulators

import com.mongodb.client.model.BsonField; //导入依赖的package包/类
public List<BsonField> getAccumulators() {
    return accumulators;
}
 
开发者ID:T-baby,项目名称:MongoDB-Plugin,代码行数:4,代码来源:MongoAccumulator.java

示例4: setAccumulators

import com.mongodb.client.model.BsonField; //导入依赖的package包/类
public MongoAccumulator setAccumulators(List<BsonField> accumulators) {
    this.accumulators = accumulators;
    return this;
}
 
开发者ID:T-baby,项目名称:MongoDB-Plugin,代码行数:5,代码来源:MongoAccumulator.java


注:本文中的com.mongodb.client.model.BsonField类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。