0 points

Find duplicates


dashboard

Mon Nov 02 2020 13:14:31 GMT+0000 (UTC)

Posted by @salitha.pathi #mongoshell

db.getCollection('Transaction').aggregate([
    {"$group" : { "_id": "$transactionNo", "count": { "$sum": 1 }, "ids":{"$push":"$_id"} } },
    {"$match": {"_id" :{ "$ne" : null } , "count" : {"$gt": 1} } }
])
content_copy Copy

https://stackoverflow.com/questions/26984799/find-duplicate-records-in-mongodb