/* Update Data to IOS Users*/
'use strict';
var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://10.0.0.5:27017/";
var pgsqlUtils = require('./../../utils/pgsql.utils');
//Get Data from Mongo
MongoClient.connect(url, function(err, db) {
    if (err) throw err;
    var dbo = db.db("aiproddb");
         let skip = parseInt(process.argv[2]);
          
         dbo.collection("app_users5d5fd1290200e5b6009d6478").find().skip(skip).limit(30000).toArray(function(err, result) {
             if (err) throw err;
             result.forEach(element => {
                                
                    let queryCitus= "UPDATE app_users_5d5fd1290200e5b6009d6478 SET active = '" + element.active + "' , sc= '" + element.sc + "' , tsd = '" + element.tsd + "' WHERE did = '" + element.did + "'";
                        // Citus Query
                    pgsqlUtils.executeQuery(queryCitus)
                        .then(res =>{
                           
                        })
                        .catch(error =>{
                             
                        });
             });
         });
});
