Skip to content

Instantly share code, notes, and snippets.

@ekmartin
Created February 20, 2015 18:32
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 ekmartin/8ece494fdb23d2e62351 to your computer and use it in GitHub Desktop.
Save ekmartin/8ece494fdb23d2e62351 to your computer and use it in GitHub Desktop.
Votemapping
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