mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-04-14 11:46:23 +00:00
wip(indexes): starter code for handling duplicate accounts #3986
This commit is contained in:
parent
7e91fa4524
commit
aa0c365326
1 changed files with 14 additions and 0 deletions
14
database_reports/duplicate_indexes.js
Normal file
14
database_reports/duplicate_indexes.js
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
db.users.aggregate([
|
||||
{ $group: {
|
||||
// _id: { "auth.local.username": "$auth.local.username" },
|
||||
// _id: { "auth.facebook.id": "$auth.facebook.id" },
|
||||
_id: { "auth.local.email": "$auth.local.email" },
|
||||
uniqueIds: { $addToSet: "$_id" },
|
||||
count: { $sum: 1 }
|
||||
}},
|
||||
{ $match: {
|
||||
count: { $gt: 1 }
|
||||
}}
|
||||
]).forEach(function(user){
|
||||
// handle duplicates. likely, delete the accounts with older lastCron, or with the starter tasks.
|
||||
})
|
||||
Loading…
Reference in a new issue