Skip to content

Instantly share code, notes, and snippets.

@matiasa18
Created December 17, 2013 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matiasa18/8007867 to your computer and use it in GitHub Desktop.
Save matiasa18/8007867 to your computer and use it in GitHub Desktop.
var mongoose = require('mongoose'),
auto_increment = require('mongoose-auto-increment');
var category_schema = new mongoose.Schema({
name: {required: true, type: String},
categories: [{ name: {required: true, type: String}}],
parent_id: Number
});
category_schema.plugin(auto_increment.plugin, 'Category');
category_schema.plugin(auto_increment.plugin, 'Category.categories');
var Category = module.exports = mongoose.model('Category', category_schema);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment