mongodb三种去重方式

这里补充用mongodb去重的3种方式:

1、db.info_store_dynamic_info.distinct("store_id",{"time_type":2});

 

 

109f315ba98d3d2f39e86d84408ce3e6.png

 

2、db.runCommand({"distinct":"info_store_dynamic_info","key":"store_id","time_type":2});

 

 

098b42703cc86d23e2982f4b3e74f5dc.png

 

 

3、

db.getCollection('info_store_daily_info').aggregate([{$group:{'_id':{'store_id':'$store_id','is_push':'$is_push'}}}])

 

 

a3f5c01344032d348ebd566f71c0a0be.png

 

 

相关推荐

  1. List的五方法

    2024-07-14 22:50:02       38 阅读
  2. js数组(4方法)

    2024-07-14 22:50:02       20 阅读
  3. MongoDB——函数Distinct

    2024-07-14 22:50:02       53 阅读
  4. go语言切片的3方式总结

    2024-07-14 22:50:02       25 阅读
  5. List数据的4有效方法

    2024-07-14 22:50:02       44 阅读
  6. js 数组的6方法

    2024-07-14 22:50:02       31 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-14 22:50:02       70 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-14 22:50:02       74 阅读
  3. 在Django里面运行非项目文件

    2024-07-14 22:50:02       62 阅读
  4. Python语言-面向对象

    2024-07-14 22:50:02       72 阅读

热门阅读

  1. 深入探索 Spring Bean 生命周期中的自定义扩展方法

    2024-07-14 22:50:02       20 阅读
  2. mybatisplus 查询某一字段

    2024-07-14 22:50:02       21 阅读
  3. 探索AI艺术:简单方法训练你的AI画家(思路)

    2024-07-14 22:50:02       20 阅读
  4. 【LeetCode】125. 验证回文串

    2024-07-14 22:50:02       18 阅读
  5. 基于STM32F103的二维码识别项目

    2024-07-14 22:50:02       21 阅读
  6. 极速构建的艺术:Kylin中Cube的并行构建实践

    2024-07-14 22:50:02       21 阅读
  7. 设计模式的分类

    2024-07-14 22:50:02       16 阅读
  8. Docker--在linux安装软件

    2024-07-14 22:50:02       22 阅读
  9. OpenJudge | 回文串判断

    2024-07-14 22:50:02       22 阅读