Open kr1zz opened 1 month ago
Lately, users seem to be registered multiple times (at least twice, sometimes more). So we should find why we obtain duplicate users, fix that, and clean the DB.
Robo3t code for finding duplicates:
db.users.aggregate([ { $group: { _id: "$userId", count: { $sum: 1 } } }, { $match: { count: { $gt: 1 } } }, { $sort: { count: -1 } // Optional: sorts by count in descending order } ])
Lately, users seem to be registered multiple times (at least twice, sometimes more). So we should find why we obtain duplicate users, fix that, and clean the DB.
Robo3t code for finding duplicates: