function seedDB(connection) {
  try {
    connection.then(function (db) {
      let seedData = [];
      for (let word of glossary) {
        let newEntry = {
          word: word,
          reductions: [...nummificate(word)["AQ"].reduce()],
          hits: 0,
        };
        seedData.push(newEntry);
      }

      GlossaryEntry.insertMany(seedData, function(err, docs) {
        if (err) console.error(err);
        console.log("database seeded! :)");
      });
    });
  } catch (error) {
    console.error(error);
  }
}
/**
 * @param (function) connection - a mongoose connection
 */
@param (function) connection - a mongoose connection
@param ( function ) connection - a mongoose connection
function seedDB(connection) {
  try {
    connection.then(function (db) {
      let seedData = [];
      for (let word of glossary) {
        let newEntry = {
          word: word,
          reductions: [...nummificate(word)["AQ"].reduce()],
          hits: 0,
        };
        seedData.push(newEntry);
      }
      GlossaryEntry.insertMany(seedData, function(err, docs) {
        if (err) console.error(err);
        console.log("database seeded! :)");
      });
    });
  } catch (error) {
    console.error(error);
  }
}
function seedDB ( connection ) { try { connection . then ( function ( db ) { let seedData = [ ] ; for ( let word of glossary ) { let newEntry = { word : word , reductions : [ ... nummificate ( word ) [ "AQ" ] . reduce ( ) ] , hits : 0 , } ; seedData . push ( newEntry ) ; } GlossaryEntry . insertMany ( seedData , function ( err , docs ) { if ( err ) console . error ( err ) ; console . log ( "database seeded! :)" ) ; } ) ; } ) ; } catch ( error ) { console . error ( error ) ; } }
@param (function) connection - a mongoose connection
@param ( function ) connection - a mongoose connection