• mongoDB日常操作01


    //serialno_info.i,查看历史最大值

    db.serialno_info.find({'_id':'define_picture'})

    //查看文件记录有序id条数

    db.fs.files.find({$where:"(this._id.length < 10)"}).count()

    //查看文件记录id有序且文件类型为pdf条数

    db.fs.files.find({$where:"(this._id.length < 10)",'filename':{$regex:'pdf'}}).count()

    //查看文件系统有序id条数

    db.fs.chunks.find({$where:"(this.files_id.length < 10)"}).count()

    //查看文件记录id有序且在文件系统中无对应记录 的所有记录

    db.fs.files.find({$where:"(this._id.length < 10)",'_id':{$nin:db.fs.chunks.distinct('files_id')}})

    //查看文件系统id有序且在文件记录中无对应纪录 的所有记录

    db.fs.chunks.find({$where:"(this.files_id.length < 10)",'files_id':{$nin:db.fs.files.distinct('_id')}})



    //customer_info   cwd_customer_info.protocol

    db.customer_info.find({'cwd_customer_info.protocol':{$exists:true}},{'cwd_customer_info.protocol':1})

    //customer_info   jzd_customer_info.o2

    db.customer_info.find({'jzd_customer_info.o2':{$exists:true}},{'jzd_customer_info.o2':1})

    //customer_info   yfd_customer_info.customer_info.protocol

    db.customer_info.find({'yfd_customer_info.customer_info.protocol':{$exists:true}},{'yfd_customer_info.customer_info.protocol':1})

    //students_idnyc_info students_idnyc_info.o1

    db.students_idnyc_info.find({'students_idnyc_info.o1':{$exists:true}},{'students_idnyc_info.o1':1})

    //partner_smk_oder partner_smk_order.o1

    db.partner_smk_oder.find({'partner_smk_order.o1':{$exists:true}},{'partner_smk_order.o1':1})

    //pxfq_business_info pxfq_business_info.protocol

    db.pxfq_business_info.find({'pxfq_business_info.sign_protocol':{$exists:true}},{'pxfq_business_info.sign_protocol':1})

    //customer_info   customer_info.protocol

    db.customer_info.find({'customer_info.protocol':{$exists:true}},{'customer_info.protocol':1})

    //customer_info   customer_info.o1

    db.customer_info.find({'customer_info.o1':{$exists:true}},{'customer_info.o1':1})

    //customer_info   zffq_customer_info.o1

    db.customer_info.find({'zffq_customer_info.o1':{$exists:true}},{'zffq_customer_info.o1':1})

    //partner_customer_info partner_customer_info.[*].o1

    统计测额人数
    db.customer_info.find({'customer_info.market':'ERWED','customer_info.l':{$exists:true}}).count()

    测额总量
    db.customer_info.aggregate([
    {
        '$match':{'customer_info.market':'ERWED'}
    },
    {
        '$group':{
            '_id': null,
            'sum':{$sum:'$customer_info.l'}
            }
    }
    ])

    对字符大于小于做条件查询
    db.lcpt_group_info.find({
        $where:'this.lcpt_group_info.cgsize && parseInt(this.lcpt_group_info.cgsize) >= 4'
        })


    去重查询,json形式,如果要去重查询总数,在后面加  .values.length
    db.runCommand({'distinct':'erwed_customer_info','key':'erwed_customer_info.company_name'}).values.length

  • 相关阅读:
    大数据技术栈,主要有哪些
    微服务海量日志监控平台
    Elastic APM安装
    Elasticsearch SSL认证/证书制作
    Elastic APM 上报数据分析与应用
    elasticsearch7.X x-pack破解
    Netty源码学习系列之5-NioEventLoop的run方法
    Netty源码学习系列之4-ServerBootstrap的bind方法
    Netty源码学习系列之3-ServerBootstrap的初始化
    Netty源码学习系列之2-NioEventLoopGroup的初始化
  • 原文地址:https://www.cnblogs.com/nnnnmmmm/p/13665485.html
Copyright © 2020-2023  润新知