fadeoutsoftware / WASDI

Web Advanced Space Developers Interface
http://www.wasdi.net
GNU General Public License v3.0
13 stars 5 forks source link

Users duplication (multiplication) #760

Open kr1zz opened 1 month ago

kr1zz commented 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
  }
])