db.getCollection('archive_person').aggregate( 
{'$group':{
        '_id': {'category': '$category'},
        'uniqueIds': {'$addToSet': '$_id'},
        'count' : {'$sum': 1}
    }},
    {'$match': {
        'count': {'$gt': 1}
    }}
)

category 替换为要查询的重复字段

 

相关文章:

  • 2021-12-24
  • 2022-01-24
  • 2022-12-23
  • 2022-12-23
  • 2021-05-27
猜你喜欢
  • 2021-12-13
  • 2022-12-23
  • 2021-11-29
  • 2021-12-28
  • 2021-12-28
  • 2021-11-17
相关资源
相似解决方案