db.getCollection(‘workers’).aggregate(
{‘$group’:{
‘_id’: {‘workerId’: ‘$workerId’},
‘uniqueIds’: {‘$addToSet’: ‘$_id’},
‘count’ : {‘$sum’: 1}
}},
{‘$match’: {
‘count’: {‘$gt’: 1}
}}
)
db.getCollection(‘workers’).aggregate(
{‘$group’:{
‘_id’: {‘workerId’: ‘$workerId’},
‘uniqueIds’: {‘$addToSet’: ‘$_id’},
‘count’ : {‘$sum’: 1}
}},
{‘$match’: {
‘count’: {‘$gt’: 1}
}}
)
没有回复内容