const mongoose = require('mongoose'); const Schema = mongoose.Schema; let chapter = new Schema( { scanlator: {type: String, required: true, max: 100}, title: {type: String, required: true, max: 100}, link:{type: String, require:true, max:100}, chapterNum:{type: Number, require:true}, lastImageRead:{type:Number, required:false}, completely:{type:Boolean, required:false} } ); const Chapter = module.exports = mongoose.model('chapter', chapter, 'mangareaderchapters'); module.exports.get = (callback, limit)=> { Chapter.find(callback).limit(limit); }