'use strict';

var mongoose = require('mongoose'),
    Schema = mongoose.Schema;

var CourseSchema = new Schema({
  code: { type: String, required: true, unique: true, uppercase: true },
  title: { type: String, required: true },
  category: [ String ],
  subcategory: [String],
  prerequisite: [ { type: Schema.Types.ObjectId, ref: 'Course' } ],
});

// Virtuals 
CourseSchema
  .virtual('canDoubleCount')
  .get(function(){
    return this.category.length > 1;
  });

module.exports = mongoose.model('Course', CourseSchema);
@@ -340,16 +340,79 @@
 e' %7D %5D,%0A
+  doubleCount: %5B%7B%0A    replace: String,%0A    freeUp: String%0A  %7D%5D%0A
 %7D);%0A%0A// 

Update the course model