wikijs-fork/models/entry.js

53 lines
704 B
JavaScript
Raw Normal View History

"use strict";
2016-11-21 01:09:50 +00:00
const Promise = require('bluebird'),
_ = require('lodash');
/**
* Entry schema
*
* @type {<Mongoose.Schema>}
*/
2016-11-21 01:09:50 +00:00
var entrySchema = Mongoose.Schema({
_id: String,
title: {
type: String,
required: true,
minlength: 2
},
subtitle: {
type: String,
default: ''
},
parent: {
type: String,
default: ''
},
content: {
type: String,
default: ''
}
},
{
timestamps: {}
});
entrySchema.index({
_id: 'text',
title: 'text',
subtitle: 'text',
content: 'text'
}, {
weights: {
_id: 3,
title: 10,
subtitle: 5,
content: 1
},
name: 'EntriesTextIndex'
});
2016-11-21 01:09:50 +00:00
module.exports = Mongoose.model('Entry', entrySchema);