본문 바로가기
데이터 베이스/MongoDB

[MongoDB] 필드에 중복 데이터 여부 체크

by 우주다람쥐 2021. 4. 14.
반응형
db.collection.aggregate(
    {"$group" : { "_id": "$name", "count": { "$sum": 1 } } },
    {"$match": {"_id" :{ "$ne" : null } , "count" : {"$gt": 1} } },
    {"$sort": {"count" : -1} },
    {"$project": {"name" : "$_id", "_id" : 0} }    
)
반응형

'데이터 베이스 > MongoDB' 카테고리의 다른 글

[MongoDB] Version Upgrade 방법  (0) 2021.04.14

댓글