MongoDB: find duplicates in a field
db.mycollection.aggregate([
{$group : { id: "$myfield" , count : { $sum: 1}}},
{$match : { count : { $gt : 1 } }} ])
Written by Snehal Parmar
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Tags
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#