zoukankan      html  css  js  c++  java
  • 常用mongo语句

    只列出指定字段
    db.getCollection('PUBLICACCOUNTS').find({},{NickName:1,UserName:1,FID:1,_id:0})
    获取微信公众号列表
    db.getCollection('RELATIONALINFO').find({oidOrUid:{$ne:""},"folderInfo.available":1,sourceId:{$ne:""},accountType:1,ownerId:{$in:[0,1]}})
    删除全部微信文章
    db.getCollection('FollowMessage').remove({source:"weixin"})
    修改微信公众号的lastPublicTime,lastGrabbeTime
    db.getCollection('RELATIONALINFO').update({accountType:1},{$set:{lastPublicTime: ISODate("1999-12-31T16:00:00.000Z"),lastGrabbeTime: ISODate("1999-12-31T16:00:00.000Z")}},{multi:true})
    获取绑定了3个folder的账号
    db.getCollection('RELATIONALINFO').find({folderInfo:{$size:3}})
    列出指定字段 排序
    db.getCollection('FollowMessage').find({source:"weixin"}, {originalId: 1,"data.title": 1, _id:0,publishedAt:1 }).sort({publishedAt:-1})
    获取广华的微博
    db.getCollection('FollowMessage').find({oidOrUid:"2244734372"}).sort({createdAt:-1})
    查找某些台的歌曲 in
    db.getCollection('FollowMessage').find({stationId:{$in:["97105541-2563-E411-A33D-AC853D9F52F0","6a396fc0-5465-e411-a33d-ac853d9f52f0","bd6104a9-30c7-43c8-b907-d59911be5081","d862ce91-661c-4e50-b055-a4f901308274","e92132ce-952b-e511-b870-a35aa304d87f","6b4a168f-ba09-e511-b870-a35aa304d87f","4e7e41a0-653a-e511-b870-a35aa304d87f","232d2efb-1363-e411-a33d-ac853d9f52f0","3b2d490a-89a0-4f2d-9815-a4fa0129728e"]}})
    根据来源进行分类统计 group
    db.getCollection('FollowMessage').group({
    key:{'source':1},reduce:function(doc,aggr){aggr.count++},initial:{'count':0}
    })

  • 相关阅读:
    使用STM32驱动双通道12位DAC(TLV5618)
    CentOS 7挂载离线yum源
    有关于Git的使用的一点心得和说明
    STM32单片机学习心得——MDK使用技巧
    小米手机连接ADB
    我看操作系统的发展
    centos7下cups + samba共打印服务
    CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙步骤
    centos7 更新yum源
    CentOS7 安装Odoo9.0
  • 原文地址:https://www.cnblogs.com/simadi/p/6382289.html
Copyright © 2011-2022 走看看