mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-01-14 11:22:21 +01:00
41 lines
602 B
JavaScript
41 lines
602 B
JavaScript
'use strict';
|
|
|
|
/**
|
|
* Module dependencies
|
|
*/
|
|
var mongoose = require('mongoose'),
|
|
Schema = mongoose.Schema;
|
|
|
|
/**
|
|
* Article Schema
|
|
*/
|
|
var ArticleSchema = new Schema({
|
|
created: {
|
|
type: Date,
|
|
default: Date.now
|
|
},
|
|
title: {
|
|
type: String,
|
|
default: '',
|
|
trim: true,
|
|
required: 'Title cannot be blank'
|
|
},
|
|
content: {
|
|
type: String,
|
|
default: '',
|
|
trim: true
|
|
},
|
|
user: {
|
|
type: Schema.ObjectId,
|
|
ref: 'User'
|
|
},
|
|
test: {
|
|
type: String,
|
|
default: 'def'
|
|
}
|
|
});
|
|
|
|
ArticleSchema.index({user: -1, created: -1});
|
|
|
|
mongoose.model('Article', ArticleSchema);
|