<repo_name>and-digital/dekker-arc<file_sep>/services/casestudy.service.js
var ToDo = require('../models/casestudy.model')

_this = this


exports.getCaseStudies = async function(query, page, limit){
    var options = {
        page,
        limit
    }
    try {
        var casestudies = await CaseStudy.paginate(query, options)
        return casestudies;
    } catch (e) {
        throw Error('Error while Paginating Todos')
    }
}

<file_sep>/models/casestudy.model.js
var mongoose = require('mongoose')
var mongoosePaginate = require('mongoose-paginate')


var caseStudySchema = new mongoose.Schema({
    title: String,
    description: String,
    date: Date,
    status: String
})

caseStudySchema.plugin(mongoosePaginate)
const casestudy = mongoose.model('casestudy', caseStudySchema)

module.exports = casestudy;