Find duplicates

PHOTO EMBED

Mon Nov 02 2020 13:14:31 GMT+0000 (Coordinated Universal Time)

Saved 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_copyCOPY

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