Last active
February 22, 2016 17:10
-
-
Save chertpong/c5a32caca31003ed55d3 to your computer and use it in GitHub Desktop.
Mongoose simple model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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