2017-02-09 01:52:37 +00:00
|
|
|
'use strict'
|
2016-10-15 03:31:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Entry schema
|
|
|
|
*
|
|
|
|
* @type {<Mongoose.Schema>}
|
|
|
|
*/
|
2016-11-21 01:09:50 +00:00
|
|
|
var entrySchema = Mongoose.Schema({
|
2016-10-15 03:31:15 +00:00
|
|
|
|
2017-02-09 01:52:37 +00:00
|
|
|
_id: String,
|
2016-10-15 03:31:15 +00:00
|
|
|
|
|
|
|
title: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
minlength: 2
|
|
|
|
},
|
|
|
|
subtitle: {
|
|
|
|
type: String,
|
|
|
|
default: ''
|
|
|
|
},
|
|
|
|
parent: {
|
|
|
|
type: String,
|
|
|
|
default: ''
|
|
|
|
},
|
|
|
|
content: {
|
|
|
|
type: String,
|
|
|
|
default: ''
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
2017-02-09 01:52:37 +00:00
|
|
|
{
|
|
|
|
timestamps: {}
|
|
|
|
})
|
2016-10-15 03:31:15 +00:00
|
|
|
|
|
|
|
entrySchema.index({
|
|
|
|
_id: 'text',
|
|
|
|
title: 'text',
|
|
|
|
subtitle: 'text',
|
|
|
|
content: 'text'
|
|
|
|
}, {
|
|
|
|
weights: {
|
|
|
|
_id: 3,
|
|
|
|
title: 10,
|
|
|
|
subtitle: 5,
|
|
|
|
content: 1
|
|
|
|
},
|
|
|
|
name: 'EntriesTextIndex'
|
2017-02-09 01:52:37 +00:00
|
|
|
})
|
2016-10-15 03:31:15 +00:00
|
|
|
|
2017-02-09 01:52:37 +00:00
|
|
|
module.exports = Mongoose.model('Entry', entrySchema)
|