Created
September 20, 2012 06:04
-
-
Save swallentin/3754204 to your computer and use it in GitHub Desktop.
Mongoose.js Model Schema Definition Template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mongoose = require('mongoose') | |
, Schema = mongoose.Schema | |
, ObjectId = Schema.ObjectId | |
, UserSchema = require('./User').Schema | |
, GameSchema = new Schema({ | |
'name': { type: String }, | |
'player_a': { type: ObjectId, ref: "User" }, | |
'player_b': { type: ObjectId, ref: "User" }, | |
'score': { type: Number, default: 0} | |
}); | |
exports.Schema = GameSchema; | |
exports.Model = mongoose.model('Game', GameSchema); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment