loadData(collection, jsonFile) {
    check(collection, Mongo.Collection);
    check(jsonFile, Match.Optional(String));

    // prevent import if existing collection data
    if (collection.find().count() > 0) {
      return false;
    }

    let json = null;
    let result = null;

    Core.Log.debug(
      `Loading initialisation data for ${collection._name}`);
    // if jsonFile was path wasn't provided
    // we'll assume we're loading collection data
    if (!jsonFile) {
      json = EJSON.parse(Assets.getText("data/" + collection._name +
        ".json"));
    } else {
      json = EJSON.parse(jsonFile);
    }

    // loop over each item in json and insert into collection
    for (let item of json) {
      try {
        result = collection.insert(item);
      } catch (err) {
        Core.Log.error("Error adding initialisation data to " +
          collection._name + ":", err.message);
      }
    }

    if (result) {
      Core.Log.info(
        `Success importing initialisation data to ${collection._name}`
      );
    }
  }
/**
   * BootstrapLoader.loadData
   * @summary imports collection initialisation data
   * @param {Object} collection - The collection to import
   * @param {String} jsonFile - path to json File.
   * @return {Boolean} boolean -  returns true on insert
   */
BootstrapLoader.loadData
@summary imports collection initialisation data
@param {Object} collection - The collection to import
@param {String} jsonFile - path to json File.
@return {Boolean} boolean -  returns true on insert
BootstrapLoader . loadData @summary imports collection initialisation data @param { Object } collection - The collection to import @param { String } jsonFile - path to json File . @return { Boolean } boolean - returns true on insert
loadData(collection, jsonFile) {
    check(collection, Mongo.Collection);
    check(jsonFile, Match.Optional(String));
    if (collection.find().count() > 0) {
      return false;
    }
    let json = null;
    let result = null;
    Core.Log.debug(
      `Loading initialisation data for ${collection._name}`);
    if (!jsonFile) {
      json = EJSON.parse(Assets.getText("data/" + collection._name +
        ".json"));
    } else {
      json = EJSON.parse(jsonFile);
    }
    for (let item of json) {
      try {
        result = collection.insert(item);
      } catch (err) {
        Core.Log.error("Error adding initialisation data to " +
          collection._name + ":", err.message);
      }
    }
    if (result) {
      Core.Log.info(
        `Success importing initialisation data to ${collection._name}`
      );
    }
  }
loadData ( collection , jsonFile ) { check ( collection , Mongo . Collection ) ; check ( jsonFile , Match . Optional ( String ) ) ; if ( collection . find ( ) . count ( ) > 0 ) { return false ; } let json = null ; let result = null ; Core . Log . debug ( ` ${ collection . _name } ` ) ; if ( ! jsonFile ) { json = EJSON . parse ( Assets . getText ( "data/" + collection . _name + ".json" ) ) ; } else { json = EJSON . parse ( jsonFile ) ; } for ( let item of json ) { try { result = collection . insert ( item ) ; } catch ( err ) { Core . Log . error ( "Error adding initialisation data to " + collection . _name + ":" , err . message ) ; } } if ( result ) { Core . Log . info ( ` ${ collection . _name } ` ) ; } }
BootstrapLoader.loadData
 @summary imports collection initialisation data
 @param {Object} collection - The collection to import
 @param {String} jsonFile - path to json File.
BootstrapLoader . loadData @summary imports collection initialisation data @param { Object } collection - The collection to import @param { String } jsonFile - path to json File .
// prevent import if existing collection data // if jsonFile was path wasn't provided // we'll assume we're loading collection data // loop over each item in json and insert into collection