Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Included an sample schema for Mongo

  • Loading branch information...
commit 6ce0e55b4dbccb724b6f377d8884b56fa8960049 1 parent 0af374a
Ed Lau authored
Showing with 22 additions and 0 deletions.
  1. +22 −0 templates/models/post.js
View
22 templates/models/post.js
@@ -0,0 +1,22 @@
+
+// Schema
+function make(Schema, mongoose) {
+
+ CommentSchema = new Schema({
+ body : { type: String }
+ , created : { type: Date, default: Date.now }
+ });
+ mongoose.model('Comment', CommentSchema);
+
+ PostSchema = new Schema({
+ title : { type: String, default: 'New Post' }
+ , body : { type: String }
+ , created : { type: Date, default: Date.now }
+ , updated : { type: Date, default: Date.now }
+ , comments: [CommentSchema]
+ });
+ mongoose.model('Post', PostSchema);
+}
+
+module.exports.make = make;
+
Please sign in to comment.
Something went wrong with that request. Please try again.