Skip to content

Instantly share code, notes, and snippets.

@chertpong
Last active February 22, 2016 17:10
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 chertpong/c5a32caca31003ed55d3 to your computer and use it in GitHub Desktop.
Save chertpong/c5a32caca31003ed55d3 to your computer and use it in GitHub Desktop.
Mongoose simple model
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
mongoose.Promise = require('bluebird');
var courseSchema = new Schema({
name:{ type : String, unique : true },
description:{ type : String},
tags:[
{ type : String }
],
price : { type: Number }
});
var Course = mongoose.model('Course', courseSchema ,'Courses');
module.exports = Course;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment