{"size": 1077, "ext": "js", "max_stars_repo_path": "test/convertDBFieldType.js", "max_stars_repo_name": "sillicon/ReportDashboard", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/convertDBFieldType.js", "max_issues_repo_name": "sillicon/ReportDashboard", "max_issues_repo_issues_event_min_datetime": "2017-12-21T20:12:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-12-21T20:12:16.000Z", "max_forks_repo_path": "test/convertDBFieldType.js", "max_forks_repo_name": "sillicon/ReportDashboard", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 41.4230769231, "max_line_length": 247, "alphanum_fraction": 0.6787372331}
var MongoClient = require('mongodb').MongoClient;
var moment = require('moment');

dataBaseUrl = 'mongodb://publisher:readandwrite@qareport-shard-00-00-bwtot.mongodb.net:27017,qareport-shard-00-01-bwtot.mongodb.net:27017,qareport-shard-00-02-bwtot.mongodb.net:27017/qareport?ssl=true&replicaSet=qareport-shard-0&authSource=admin';

MongoClient.connect(dataBaseUrl, function (err, db) {
	if (err) {
		console.log("Unable to connect to MongoDB Server. Please check DB Server status.");
		console.error(err);
		process.exit(1);
	}
    console.log("Successfully connected to MongoDB server");

    var collection = db.collection('reportResult');
    // Find some documents
    // if don't want "_id" attribute: project({ _id: 0, 'child._id': 0, 'child.child._id': 0})
    collection.find().toArray(function (err, docs) {
        docs.forEach(function (element) {
            var temp = moment.utc(element.testDate.toLocaleDateString()).toDate();
            collection.findOneAndUpdate({"_id": element._id}, {$set: {"testDate": temp}}
            )
        });
        
    });

})