zoukankan      html  css  js  c++  java
  • Mongo 查询

    Mongo 查询

     

    mongo js 遍历

    db.getCollection('CPU').find({}).limit(100).sort({"time":-1}).forEach(
    function(a){
        a["v"]=(new Date(a["time"]).toString());
        printjson((a["v"]))
        })
     

    mongo 聚合

    db.CPU.aggregate({
        $group:{_id:       
                
                 {time:{ $mod: [ 4,1 ] }},
                 "a":
                 {$where: function() { return obj.credits - obj.debits < 0; }}
                 
                  
               }
        })
     
     
     db.CPU.aggregate({"$group":{"_id":{$ceil:{"$divide":["$time",60]}}}}).sum()
     

    mongo 查询

    db.getCollection('CPU').find({ $where: "this.time % 60 == 0" }).limit(360)
     

    mongo Mapreduce

    db.CPU.mapReduce(
        function() {emit(this._id,this.time);},
        function(key,values) {return Array.sum(values)},
           {
               query:{},
               
               }
    )

    markdownFile.md

  • 相关阅读:
    Linux之SSH详解
    Linux下的静态路由配置
    Linux之防火墙配置
    五、SQL 转换:Oracle 转 MySQL
    四、Oracle转Mysql总结
    三、MySQL 替代 Oracle 序列以及自增长处理
    二、MySQL 高级部分
    一、MySQL 基础
    15-1、常用类
    14-1、GUI
  • 原文地址:https://www.cnblogs.com/yunpiao111/p/6294743.html
Copyright © 2011-2022 走看看