const _ip2geo = require('./util/ip')(); 
_ip2geo.init();
const cron = require('cron');

const CronJob = cron.CronJob;
const job = new CronJob({
  cronTime: '00 00 * * * 0-6',
  onTick: function() {
    fetchRecoginto();
  },
  start: false,
});

//console.dir(_ip2geo.binarySearch('1.119.186.194'));
const db = require('../db');
const moment = require('moment');
async function task(argument) {
	const recognition = await db.getCollection('recognition');
	const account = await db.getCollection('account')
	const arrs = recognition.find({date:{$exists:false}});
	
	arrs.forEach( async ( item ) => {
		console.dir(moment(item.createdAt).format('YYYYMMDD'));
		const count = await bills.update({_id:item._id},{ $set:{date:moment(item.createdAt).format('YYYYMMDD') }});
		console.dir(count);
	});
}

task();