<commit_before>var mongoose = require('mongoose');

var CommentSchema = new mongoose.Schema({
	body: String,
	author: String,
	upvotes: {type: Number, default: 0},
	item: { type: mongoose.Schema.Types.ObjectId, ref: 'Item' }
});

mongoose.model('Comment', CommentSchema);<commit_msg>added up/down vote<commit_after>var mongoose = require('mongoose');

var CommentSchema = new mongoose.Schema({
	body: String,
	author: String,
	upvotes: {type: Number, default: 0},
	item: { type: mongoose.Schema.Types.ObjectId, ref: 'Item' }
});

CommentSchema.methods.upvote = function(cb) {
	this.upvotes += 1;
	this.save(cb);
};

CommentSchema.methods.downvote = function(cb) {
	this.upvotes -= 1;
	this.save(cb);
};

mongoose.model('Comment', CommentSchema);
{'fraction_non_alphanumeric': 0.1651006711409396, 'fraction_numerical': 0.005369127516778523, 'mean_word_length': 5.601769911504425, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6929175', 'n_tokens_mistral': 265, 'n_tokens_neox': 270, 'n_words': 57}