Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var mongoose = require('mongoose');
- var Schema = mongoose.Schema;
- var ObjectId = mongoose.Schema.Types.ObjectId;
- var answerSchema = new Schema({
- description: {type: String, required: true},
- fileId: String,
- fileName: String,
- author: {
- email: String,
- label: String,
- username: String
- },
- created: {type: Date, 'default': Date.now}
- });
- var schema = new Schema({
- question: {type: String, required: true},
- author: {
- label: String,
- username: String,
- points: Number,
- tags: Array,
- job: String,
- description: String,
- avatar: String
- },
- authorId: {type: Schema.Types.ObjectId, ref: 'accounts'},
- votes: [{type: Schema.Types.ObjectId, ref: 'accounts'}],
- tags: Array,
- labels: Array,
- fileId: String,
- created: {type: Date, 'default': Date.now},
- lastActivity: {type: Date, 'default': Date.now},
- answers: [answerSchema]
- });
- var Question = mongoose.model('question', schema);
- module.exports = Question;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement