Skip to content

Instantly share code, notes, and snippets.

@uptownhr
Last active February 19, 2016 00:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uptownhr/5b9e6d3f3b64c59a54bf to your computer and use it in GitHub Desktop.
Save uptownhr/5b9e6d3f3b64c59a54bf to your computer and use it in GitHub Desktop.
var teamSchema = new Schema({
name: {type: String},
king: {type: Schema.Types.ObjectId, ref: 'User'},
players: [{type: Schema.Types.ObjectId, ref: 'User'}],
subs: [{type: Schema.Types.ObjectId, ref: 'User'}]
})
var gameSchema = new Schema({
name: {type: String, default: ''},
status: {
type: String,
enum: [
'pending',
'drafting-king',
'drafting-team',
'started',
'completed'],
default: 'pending'
},
startDate: {type: Date, default: Date.now},
players: [{type: Schema.Types.ObjectId, ref: 'User'}],
rule: {
map: {type: 'String', default: '3x3'},
player_size: {type: Number, default: 5},
sub_size: {type: Number, default: 1},
midIsBaron: {type: Boolean, default: true}
},
kings: [{type: Schema.Types.ObjectId, ref: 'User'}],
teams: [teamSchema],
//something like this
teams: [teamSchema,teamSchema],
//or like this
teams: {type: Array, default: [teamSchema, teamSchema]},
//this does work, is this the best way?
teams: {type: Array, default: [{name: ''}, {name:''}]}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment