@@ -15,28 +15,26 @@ const Promise = require('bluebird');
1515
1616pluginManager . dbConnection ( "countly" ) . then ( ( db ) => {
1717 common . db = db ;
18- const NEW_ID_STR = NEW_ID ;
19- const OLD_ID_STR = OLD_ID ;
2018 const NEW_OID = common . db . ObjectID ( NEW_ID ) ;
2119 const OLD_OID = common . db . ObjectID ( OLD_ID ) ;
2220
2321 function changeOwner ( NEW_ID , OLD_ID , done ) {
24- changeOwnerDashboard ( NEW_ID_STR , OLD_ID_STR , function ( ) {
22+ changeOwnerDashboard ( NEW_ID , OLD_ID , function ( ) {
2523 common . db . collection ( "alerts" ) . updateMany ( { createdBy : OLD_OID } , { $set : { createdBy : NEW_OID } } , function ( err , res ) {
2624 console . log ( "alerts" , err , res && res . result ) ;
27- common . db . collection ( "auth_tokens" ) . updateMany ( { owner : OLD_ID_STR } , { $set : { owner : NEW_ID_STR } } , function ( err , res ) {
25+ common . db . collection ( "auth_tokens" ) . updateMany ( { owner : OLD_ID } , { $set : { owner : NEW_ID } } , function ( err , res ) {
2826 console . log ( "auth_tokens" , err , res && res . result ) ;
29- common . db . collection ( "calculated_metrics" ) . updateMany ( { owner_id : OLD_ID_STR } , { $set : { owner_id : NEW_ID_STR } } , function ( err , res ) {
27+ common . db . collection ( "calculated_metrics" ) . updateMany ( { owner_id : OLD_ID } , { $set : { owner_id : NEW_ID } } , function ( err , res ) {
3028 console . log ( "calculated_metrics" , err , res && res . result ) ;
3129 common . db . collection ( "concurrent_users_alerts" ) . updateMany ( { created_by : OLD_OID } , { $set : { created_by : NEW_OID } } , function ( err , res ) {
3230 console . log ( "concurrent_users_alerts" , err , res && res . result ) ;
3331 common . db . collection ( "data_migrations" ) . updateMany ( { userid : OLD_OID } , { $set : { userid : NEW_OID } } , function ( err , res ) {
3432 console . log ( "data_migrations" , err , res && res . result ) ;
35- changeOwnerLongTasks ( NEW_ID_STR , OLD_ID_STR , function ( err , res ) {
33+ changeOwnerLongTasks ( NEW_ID , OLD_ID , function ( err , res ) {
3634 console . log ( "messages" , err , res && res . result ) ; // "createdBy": { "$oid": "63442fa1ec94a1edb60f2453"}
3735 common . db . collection ( "messages" ) . updateMany ( { "info.createdBy" : OLD_ID } , { $set : { "info.createdBy" : NEW_ID } } , function ( err , res ) {
3836 console . log ( "messages" , err , res && res . result ) ;
39- common . db . collection ( "notes" ) . updateMany ( { owner : OLD_ID_STR } , { $set : { owner : NEW_ID_STR } } , function ( err , res ) {
37+ common . db . collection ( "notes" ) . updateMany ( { owner : OLD_ID } , { $set : { owner : NEW_ID } } , function ( err , res ) {
4038 console . log ( "notes" , err , res && res . result ) ;
4139 common . db . collection ( "reports" ) . updateMany ( { user : OLD_OID } , { $set : { user : NEW_OID } } , function ( err , res ) {
4240 console . log ( "reports" , err , res && res . result ) ;
0 commit comments