{"size": 910, "ext": "js", "max_stars_repo_path": "models/schemas/tag.js", "max_stars_repo_name": "heroicyang/nodediscuss", "max_stars_repo_stars_event_min_datetime": "2015-01-07T06:24:18.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-13T03:12:51.000Z", "max_issues_repo_path": "models/schemas/tag.js", "max_issues_repo_name": "Quizp2p/nodediscuss", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "models/schemas/tag.js", "max_forks_repo_name": "Quizp2p/nodediscuss", "max_forks_repo_forks_event_min_datetime": "2015-01-29T08:07:04.000Z", "max_forks_repo_forks_event_max_datetime": "2019-11-14T01:51:53.000Z"}
{"max_stars_count": 31, "max_issues_count": null, "max_forks_count": 15, "avg_line_length": 14.6774193548, "max_line_length": 47, "alphanum_fraction": 0.5813186813}
/**
 * TagSchema definition
 * 本来是打算叫节点（Node）的，但是一想到文件名要取为 `node.js` 就有点难受啊
 * 不过界面上还是叫节点吧，而且这个是不允许普通用户随意增删改的
 * @author heroic
 */

/**
 * Module dependencies
 */
var mongoose = require('mongoose'),
  Schema = mongoose.Schema;

/**
 * Collection name in the database is `tag`
 * @type {Schema}
 */
var TagSchema = new Schema({
  slug: {
    type: String,
    lowercase: true,
    index: true,
    unique: true
  },
  name: {
    type: String,
    index: true
  },
  section: {
    id: {
      type: String,
      index: true
    },
    sort: Number,
    name: String
  },
  describe: String,
  topicCount: {
    type: Number,
    default: 0
  },
  favoriteCount: {
    type: Number,
    default: 0
  },
  favoriteUsers: {
    type: Array,
    default: []
  }
}, {
  collection: 'tag'
});

/**
 * Expose schema and model name
 * @type {object}
 */
module.exports = {
  schema: TagSchema,
  modelName: 'Tag'
};
