对于新手来说,model要怎样简单易用的封装?
var mongoose = require(‘mongoose’); var ThemeSchema = new mongoose.Schema({ title: String, //标题/主题 categories: String, //类别/文章类型 readingcounts: Number, //阅读量 replycounts: Number, //回复总数 bestanswer: Number, //最佳答案 releaseid: String, //发布id/文章发布人 releasetime: String, //发布时间 isessence: Number, //是否加精 istop: Number //是否置顶 }); mongoose.model(‘Theme’, ThemeSchema);
这是初始的model代码,请教大神,model怎么封装?如果有dome更好