{"size": 653, "ext": "js", "max_stars_repo_path": "server/src/models/Event.js", "max_stars_repo_name": "gabrielm0/react-dashboard", "max_stars_repo_stars_event_min_datetime": "2019-05-20T12:19:32.000Z", "max_stars_repo_stars_event_max_datetime": "2019-06-28T21:40:09.000Z", "max_issues_repo_path": "server/src/models/Event.js", "max_issues_repo_name": "gabrielm0/react-dashboard", "max_issues_repo_issues_event_min_datetime": "2021-05-06T15:54:04.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-01T17:17:27.000Z", "max_forks_repo_path": "server/src/models/Event.js", "max_forks_repo_name": "gabrielm0/react-dashboard", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": 2, "max_forks_count": null, "avg_line_length": 34.3684210526, "max_line_length": 107, "alphanum_fraction": 0.6784073507}
var mongoose = require('mongoose');
var GeoJSON = require('mongoose-geojson-schema');

var eventSchema = mongoose.Schema({
    _id: mongoose.Schema.Types.ObjectId,
    device_id: Number,
    // geojson format: Mongoose interpets this as 'location is an object with 2 keys, type and coordinates'
    /*location:{
        type: {type: String, default: 'Point'},
        coordinates: {type: [Number], default: [0, 0]}
    },*/
    location: mongoose.Schema.Types.Point,
    timestamp: Date
});
 
eventSchema.path("location").index({ type: '2dsphere'});  // ensure geospatial index
var Event = mongoose.model('Event', eventSchema);
 
module.exports = Event;