Files
habitica/migrations/facebook_to_local.js
Tyler Renelle 6ab64e2df1 add migration script for moving facebook auth'd users to local
auth (seems people hate facebook)
2013-06-14 15:56:27 -04:00

11 lines
389 B
JavaScript

var oldId = "",
newId = "",
newUser = db.users.findOne({_id: newId})
db.users.update({_id: oldId}, {$set:{auth: newUser.auth}});
// remove the auth on the new user (which is a template account). The account will be preened automatically later,
// this allows us to keep the account around a few days in case there was a mistake
db.users.update({_id: newId}, {$unset:{auth:1}});