zoukankan      html  css  js  c++  java
  • 记录MongoDB常用查询

    {$and:[{"flag" :{ $ne:"1"}},{"flag" :{ $ne:"0"}}]}  // flag不等于1 也不等于0
    {$or:[{"flag" :{ $ne:"1"}},{"flag" :{ $ne:"0"}}]}  // flag不等于1 或者不等于0
    db.xx_spider_agent.update({'tag':'111'},{$set:{'tag':'0'}},{multi:true})

    db.wuba_SaleHouseList_20180716.aggregate([{$group : {_id : "$city", num_tutorial : {$sum : 1}}}]) = select city,count(*) from wuba_SaleHouseList_20180716 group by city 常规的聚合统计

    db.anjuke_houseranking_20180717120000.aggregate([{$group : {_id : {name:"$city",st:"$type"}, count : {$sum : 1}}}]) = select city,type,count(*) from wuba_SaleHouseList_20180716 group by city ,type

    db.lianjia_showlooks.find({"showings":{$type:16}}).forEach(function(x){x.showings=String(x.showings);db.lianjia_showlooks.save(x)}) 替换int类型的字段为String 类型

    db.wuba_houseranking_20180913140000.aggregate([
    {$group:{"_id": { "city" : "$city", "type": "$type",} ,"number":{$sum:1}}},
    {$project:{"_id": false, "city" : "$_id.city", "type" : "$_id.type","number" : true}},
    {$sort:{"number":-1}},
    ])

    db.xms_orgID.updateMany({},{$set:{"tag":"1"}})

  • 相关阅读:
    解决loss值不下降问题(转)
    c++ int转string
    图的遍历
    JavaScript类型和语法
    cesium清除选定事件
    cesium中divPoint展示数据
    cesium安装及第一个示例
    2、cesium页面小控件的隐藏
    4、cesium场景出图,打印图件
    5、cesium点击面高亮事件
  • 原文地址:https://www.cnblogs.com/tnsay/p/9014823.html
Copyright © 2011-2022 走看看