const db = require('../db');
const moment = require('moment');
async function task(argument) {
	//const bills = await db.getCollection('bills');
	const account = await db.getCollection('account')
	const arrs = await account.find({}).toArray();
	
	//console.dir(arrs.length);
	arrs.forEach( async ( {_id,email,fromID} ) => {
		console.dir(email);
		if(fromID) {
			let rep = await account.update({_id},{$set:{agentDiscount:{ 
				"pipeDiscount" : 0.6,
        		"dataDiscount" : 0.3,
        		"agentID" : fromID}}})
			console.dir(re.result);
		}
	});
}

task();


