<filename>obj_test_issues.js
// database setup
var mongoose = require('mongoose');
var Schema = mongoose.Schema,
ObjectId = Schema.ObjectId;
// connect to the database
mongoose.connect(`mongodb://localhost/winterfell`);

// When successfully connected
mongoose.connection.on('connected', () => {
  console.log('Connection to database established successfully');
});

// If the connection throws an error
mongoose.connection.on('error', (err) => {
  console.log('Error connecting to database: ' + err);
});

// When the connection is disconnected
mongoose.connection.on('disconnected', () => {
  console.log('Database disconnected');
});

var Issue = require('./models/issueModel.js')
  var obj = new Issue();
  obj.name="Recreation Park in Nayapalli";
  obj.description="Recreation Park in Nayapalli";
  obj.issue_location={
    lat: '20.2898973',
    long: '85.8102212'
  };
  obj.upvotes=Math.floor(Math.random() * 50) + 10;
  obj.downvotes=0;

  var obj1 = new Issue();
  obj1.name="Self-Segregation and disposal of waste generated";
  obj1.description="BMC orders 83 apartments and a dozen educational institutions, among others, to make their own arrangements of segregating and disposing of waste generated by them.";
  obj1.issue_location={
    lat: '20.2601505',
    long: '85.7780823'
    // AMRI BBSR
  };
  obj1.upvotes=Math.floor(Math.random() * 50) + 10;
  obj1.downvotes=0;

  var obj2 = new Issue();
  obj2.name="Rally by BPUT Teachers";
  obj2.description="BPUT teachers decided to participate in a rally against the government for an unprecedented delay in salary";
  obj2.issue_location={
    lat: '20.2689549',
    long: '85.8414062'
    // master canteen
  };
  obj2.upvotes=Math.floor(Math.random() * 50) + 10;
  obj2.downvotes=0;

  var obj3 = new Issue();
  obj3.name="Designated car-free zones";
  obj3.description="Govt. plans to make Khandagiri-Udaigiri a designated car-free zones";
  obj3.issue_location={
    lat: '20.2561729',
    long: '85.780109'
    // khandagiri
  };
  obj3.upvotes=Math.floor(Math.random() * 50) + 10;
  obj3.downvotes=0;

  var obj4 = new Issue();
  obj4.name="Intelligent traffic management system";
  obj4.description="installing intelligent traffic management system near CRP";
  obj4.issue_location={
    lat: '20.2816418',
    long: '85.8107226'
  };
  obj4.upvotes=Math.floor(Math.random() * 50) + 10;
  obj4.downvotes=0;

  var obj5 = new Issue();
  obj5.name=" wi-fi spots";
  obj5.description="installing  wi-fi spots near Airport";
  obj5.issue_location={
    lat: '20.2536236',
    long: '85.8183293'
  };
  obj5.upvotes=Math.floor(Math.random() * 50) + 10;
  obj5.downvotes=0;
  console.log(obj);
  var ar = [obj1,obj2,obj3,obj4,obj5];
  for (i in ar){
    ar[i].save(function(err){
      if ( err ) throw err;
      console.log("Object Saved Successfully");
    });
  }
  

  console.log(obj);
mongoose.connection.close();
