亚洲中字慕日产2020,大陆极品少妇内射AAAAAA,无码av大香线蕉伊人久久,久久精品国产亚洲av麻豆网站

資訊專欄INFORMATION COLUMN

spring data mongo groupby實(shí)例

wemall / 3169人閱讀

模板
import static org.springframework.data.mongodb.core.aggregation.Aggregation.*;

Aggregation agg = newAggregation(
    pipelineOP1(),
    pipelineOP2(),
    pipelineOPn()
);

AggregationResults results = mongoTemplate.aggregate(agg, "INPUT_COLLECTION_NAME", OutputType.class);
List mappedResult = results.getMappedResults();
實(shí)例
        List aggs = new ArrayList<>();
        aggs.add(Aggregation.match(Criteria.where("name").is("log")));
        aggs.add(Aggregation.group("code").count().as("count"));
        aggs.add(Aggregation.project()
                .and("_id").as("code")
                .and("count").as("count"));

        Aggregation agg = Aggregation.newAggregation(aggs);

        AggregationResults results = mongoTemplate.aggregate(agg,"yourdocument", Map.class);
doc

Spring Data MongoDB - Reference Documentation

文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請注明本文地址:http://www.ezyhdfw.cn/yun/18926.html

相關(guān)文章

  • spring data mongo比較兩個字段查詢

    實(shí)例 public long countBetweenFields(String userId){ Criteria criteria = new Criteria() { @Override public DBObject getCriteriaObject() { DBObject obj = ne...

    wall2flower 評論0 收藏0
  • springboot+mongodb+docker實(shí)例

    摘要:查看數(shù)據(jù)依賴你是來自的第位訪問者。訪問參考環(huán)境下的和集成不錯 mongodb docker mongodb: image: daocloud.io/library/mongo:latest ports: - 27017:27017 robomongo(mongo mac client) showImg(https://segmentfault.com/img/bVvPV...

    Pines_Cheng 評論0 收藏0
  • springboot+mongodb+docker實(shí)例

    摘要:查看數(shù)據(jù)依賴你是來自的第位訪問者。訪問參考環(huán)境下的和集成不錯 mongodb docker mongodb: image: daocloud.io/library/mongo:latest ports: - 27017:27017 robomongo(mongo mac client) showImg(https://segmentfault.com/img/bVvPV...

    NickZhou 評論0 收藏0
  • spring+mongodb的整合

    摘要:版本不支持支持為,如果使用并且使用,則會出現(xiàn)提示,編譯出錯。掃描的倉庫目錄,會自動掃描擴(kuò)展了接口的接口進(jìn)行注入。 mongodb介紹 MongoDB 是一個基于分布式文件存儲的數(shù)據(jù)庫。由 C++ 語言編寫。旨在為 WEB 應(yīng)用提供可擴(kuò)展的高性能數(shù)據(jù)存儲解決方案。MongoDB 是一個介于關(guān)系數(shù)據(jù)庫和非關(guān)系數(shù)據(jù)庫之間的產(chǎn)品,是非關(guān)系數(shù)據(jù)庫當(dāng)中功能最豐富,最像關(guān)系數(shù)據(jù)庫的。 MongoD...

    warmcheng 評論0 收藏0
  • spring+mongodb的整合

    摘要:版本不支持支持為,如果使用并且使用,則會出現(xiàn)提示,編譯出錯。掃描的倉庫目錄,會自動掃描擴(kuò)展了接口的接口進(jìn)行注入。 mongodb介紹 MongoDB 是一個基于分布式文件存儲的數(shù)據(jù)庫。由 C++ 語言編寫。旨在為 WEB 應(yīng)用提供可擴(kuò)展的高性能數(shù)據(jù)存儲解決方案。MongoDB 是一個介于關(guān)系數(shù)據(jù)庫和非關(guān)系數(shù)據(jù)庫之間的產(chǎn)品,是非關(guān)系數(shù)據(jù)庫當(dāng)中功能最豐富,最像關(guān)系數(shù)據(jù)庫的。 MongoD...

    gaara 評論0 收藏0

發(fā)表評論

0條評論

最新活動
閱讀需要支付1元查看
<