src/server/service/import.js
/**
   * import collections from json
   *
   * @param {string} collections MongoDB collection name
   * @param {array} importSettingsMap key: collection name, value: ImportSettings instance
   */
import collections from json
@param {string} collections MongoDB collection name
@param {array} importSettingsMap key: collection name, value: ImportSettings instance
import collections from json @param { string } collections MongoDB collection name @param { array } importSettingsMap key : collection name value : ImportSettings instance
async import(collections, importSettingsMap) {
    this.currentProgressingStatus = new CollectionProgressingStatus(collections);
    try {
      const promises = collections.map((collectionName) => {
        const importSettings = importSettingsMap[collectionName];
        return this.importCollection(collectionName, importSettings);
      });
      await Promise.all(promises);
    }
    catch (err) {
      const { collectionProgress } = err;
      logger.error(`failed to import to ${collectionProgress.collectionName}`, err);
      this.emitProgressEvent(collectionProgress, { message: err.message });
    }
    finally {
      this.currentProgressingStatus = null;
      this.emitTerminateEvent();
    }
  }
async import ( collections , importSettingsMap ) { this . currentProgressingStatus = new CollectionProgressingStatus ( collections ) ; try { const promises = collections . map ( ( collectionName ) => { const importSettings = importSettingsMap [ collectionName ] ; return this . importCollection ( collectionName , importSettings ) ; } ) ; await Promise . all ( promises ) ; } catch ( err ) { const { collectionProgress } = err ; logger . error ( ` ${ collectionProgress . collectionName } ` , err ) ; this . emitProgressEvent ( collectionProgress , { message : err . message } ) ; } finally { this . currentProgressingStatus = null ; this . emitTerminateEvent ( ) ; } }
import collections from json
 @param {string} collections MongoDB collection name
 @param {array} importSettingsMap key: collection name, value: ImportSettings instance
import collections from json @param { string } collections MongoDB collection name @param { array } importSettingsMap key : collection name value : ImportSettings instance
// init status object // catch ImportingCollectionError