Created
February 20, 2015 18:32
-
-
Save ekmartin/8ece494fdb23d2e62351 to your computer and use it in GitHub Desktop.
Votemapping
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 voteMappingSchema = new Schema({ | |
user: { | |
type: Schema.Types.ObjectId, | |
ref: 'User' | |
}, | |
hasVoted: { | |
type: Boolean, | |
default: false | |
} | |
}); | |
var electionSchema = new Schema({ | |
title: { | |
type: String, | |
required: true, | |
index: true | |
}, | |
description: { | |
type: String | |
}, | |
alternatives: [ | |
{ | |
type: Schema.Types.ObjectId, | |
ref: 'Alternative' | |
} | |
], | |
active: { | |
type: Boolean, | |
default: false | |
}, | |
voteMapping: [voteMappingSchema] | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment