Repository navigation
MongoDB
Andrew Casner edited this page May 27, 2016
·
2 revisions
"By offering the best of traditional databases as well as the flexibility, scale, and performance required by today’s applications, MongoDB lets innovators deploy apps as big as they can possibly dream. From startups to enterprises, for the modern and the mission-critical, MongoDB is the database for giant ideas." - MongoDB
A schema is a javascript file that defines the values and properties of a json object to be stored in the database
Follow this code replacing the names and variables that you need.
// app/models/player.js
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var PlayerSchema = new Schema({
// Basic Info
firstName: String,
lastName: String,
isMale: Boolean,
height: Number,
weight: Number,
birthday: Date,
hometown: String,
// Athletic Info
// - stored as arrays so it can be graphed over time
// - need to add in time component
// - talk to Dawson about json objects
bench: [Number],
benchTimeStamp: [Date],
squat: [Number],
squatTimeStamp: [Date],
power: [Number],
powerTimeStamp: [Date],
dash: [Number],
dashTimeStamp: [Date],
shuffle: [Number],
shuffleTimeStamp: [Date],
vertical: [Number],
verticalTimeStamp: [Date],
// Other Info
// Sports played
sports: [String],
// Teams on
teams: [String]
});
module.exports = mongoose.model('Player', PlayerSchema);All Rights Reserved :copyright: Andrew Casner and Jason Cyrus 2016