{"size": 1219, "ext": "js", "max_stars_repo_path": "backend/database/unitFile.js", "max_stars_repo_name": "LarsonYong/devtestApp", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "backend/database/unitFile.js", "max_issues_repo_name": "LarsonYong/devtestApp", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "backend/database/unitFile.js", "max_forks_repo_name": "LarsonYong/devtestApp", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 22.5740740741, "max_line_length": 56, "alphanum_fraction": 0.5340442986}
/**
 * Created by jack on 9/1/17.
 */
var mongoose = require('mongoose');
// Connection URL
var db = 'mongodb://localhost:27017/userDetails';
mongoose.createConnection(db,function (error) {
    if (error){
        console.log(error)
    }else {
        console.log("Unit collection connected")
    }
});

var Schema = mongoose.Schema;
var buildhistory = new Schema({
    Build: String,
    Time: String
}) 
var Unit_Schema = new Schema({
    UnitId: String,
    Platform: String,
    CameraType: String,
    BuildVersion: String,
    SensorVersion: String,
    UpdateTime: String,
    BuildHistory: [buildhistory],
    
});

// [
//     {
//         "_id": "59adafd67c6218c5e02d8752",
//         "UnitId": "12156",
//         "Platform": "Odroid",
//         "CameraType": "ShanyIR",
//         "BuildVersion": "2-1-12-20170831201458",
//         "SensorVersion": "10019",
//         "UpdateTime": "0831",
//         "BuildHistory": [
//             {
//                 "2-1-12-20170827201458": "08/27/2017"
//             },
//             {
//                 "2-1-12-20170831201458": "08/31/2017"
//             }
//         ]
//     }
// ]

var Unit = mongoose.model('units', Unit_Schema);

module.exports = Unit;
