text: const fs = require('fs');
  const mongoose = require('mongoose');
  require('dotenv').config({ path: './src/config/config.env' });
  require('colors');
  const Bootcamp = require('./src/models/Bootcamp');
  const Course = require('./src/models/Course');
  const User = require('./src/models/User');
  const Review = require('./src/models/Review');
  
  // Connect to DB
  mongoose.connect(process.env.MONGO_URI_DEVELOPMENT, {
    useNewUrlParser: true,
    useUnifiedTopology: true,
    useFindAndModify: false,
    useCreateIndex: true
  });
  
  // Read JSON files
  const bootcamps = JSON.parse(
    fs.readFileSync(`${__dirname}/src/_data/bootcamps.json`, 'utf-8')
  );
  
  const courses = JSON.parse(
    fs.readFileSync(`${__dirname}/src/_data/courses.json`, 'utf-8')
  );
  
  const users = JSON.parse(
    fs.readFileSync(`${__dirname}/src/_data/users.json`, 'utf-8')
  );
  
  const reviews = JSON.parse(
    fs.readFileSync(`${__dirname}/src/_data/reviews.json`, 'utf-8')
  );
  
  // Import into DB
  const importData = async () => {
    try {
      await Bootcamp.create(bootcamps);
      await Course.create(courses);
      await User.create(users);
      await Review.create(reviews);
  
      console.log('Data imported...'.green.inverse);
      process.exit();
    } catch (error) {
      console.error(error);
    }
  };
  
  // Delete data
  const deleteData = async () => {
    try {
      await Bootcamp.deleteMany({});
      await Course.deleteMany({});
      await User.deleteMany({});
      await Review.deleteMany({});
  
      console.log('Data destroyed...'.red.inverse);
      process.exit();
    } catch (error) {
      console.error(error);
    }
  };
  
  if (process.argv[2] === '-i') {
    importData();
  } else if (process.argv[2] === '-d') {
    deleteData();
  }
  