var sqlite3 = require('sqlite3').verbose();
var db = require("../database/mongo");

let sqllite = new sqlite3.Database('./content.db', sqlite3.OPEN_READWRITE, (err) => {
    if (err) {
      console.error(err.message);
    }
    console.log('Connected to the chinook database.');
  });

  sqllite.serialize(() => {
    sqllite.each(`SELECT * from item`, (err, row) => {
      if (err) {
        console.error(err.message);
      }
      row.processed = 0;
      //console.log(row);
      db.khanitems.insert(row,function(err,data){
        if(err)
        {
            //console.log(err);
        }
        else{
            console.log(row);
        }
  }); 
    });
  });