lib/implementation.js
function replaceIdsRecursively(doc) {
                _.each(doc, function(val, key) {
                  if (key === 'workflowGuidAndLocaleDuplicates') {
                  // Do not alter ids inside the historical archive of
                  // the original orphaned docs. -Tom
                    return;
                  }
                  if ((typeof (val) === 'string') && (val.length < 100)) {
                    if (idsToNew[val]) {
                      self.apos.utils.warn('Correcting ' + doc[key] + ' to ' + idsToNew[val] + ' in join');
                      doc[key] = idsToNew[val];
                      modified = true;
                    }
                  } else if (val && (typeof (val) === 'object')) {
                    replaceIdsRecursively(val);
                  }
                });
              }
function replaceIdsRecursively(doc) {
                _.each(doc, function(val, key) {
                  if (key === 'workflowGuidAndLocaleDuplicates') {
                  // Do not alter ids inside the historical archive of
                  // the original orphaned docs. -Tom
                    return;
                  }
                  if ((typeof (val) === 'string') && (val.length < 100)) {
                    if (idsToNew[val]) {
                      self.apos.utils.warn('Correcting ' + doc[key] + ' to ' + idsToNew[val] + ' in join');
                      doc[key] = idsToNew[val];
                      modified = true;
                    }
                  } else if (val && (typeof (val) === 'object')) {
                    replaceIdsRecursively(val);
                  }
                });
              }
function replaceIdsRecursively ( doc ) { _ . each ( doc , function ( val , key ) { if ( key === 'workflowGuidAndLocaleDuplicates' ) { // Do not alter ids inside the historical archive of // the original orphaned docs. -Tom return ; } if ( ( typeof ( val ) === 'string' ) && ( val . length < 100 ) ) { if ( idsToNew [ val ] ) { self . apos . utils . warn ( 'Correcting ' + doc [ key ] + ' to ' + idsToNew [ val ] + ' in join' ) ; doc [ key ] = idsToNew [ val ] ; modified = true ; } } else if ( val && ( typeof ( val ) === 'object' ) ) { replaceIdsRecursively ( val ) ; } } ) ; }
Recursively replace all occurrences of the ids in this locale found in the given doc with their new ids per `idsToNew`. This prevents _id conflicts on insert, even though old data is still in the database under other locale names
Recursively replace all occurrences of the ids in this locale found in the given doc with their new ids per idsToNew . This prevents _id conflicts on insert even though old data is still in the database under other locale names