Skip to content

Instantly share code, notes, and snippets.

@ebourmalo
Last active August 29, 2015 14:27
Show Gist options
  • Save ebourmalo/36a0ba6c0a1b523cb4c6 to your computer and use it in GitHub Desktop.
Save ebourmalo/36a0ba6c0a1b523cb4c6 to your computer and use it in GitHub Desktop.
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var answerSchema = new Schema({
description: {type: String, required: true},
fileId: String,
createdAt: {type: Date, 'default': Date.now},
question: {type: Schema.Types.ObjectId, ref: 'questions', required: true},
author: {type: Schema.Types.ObjectId, ref: 'accounts', required: true},
}));
var Answer = mongoose.model('answer', answerSchema);
module.exports = Answer;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment