Skip to content

Instantly share code, notes, and snippets.

@jkresner
Created September 18, 2014 14:57
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 jkresner/52abc60c665aae0175e5 to your computer and use it in GitHub Desktop.
Save jkresner/52abc60c665aae0175e5 to your computer and use it in GitHub Desktop.
Testing some model code
var Author = {
userId: { required: true, type: ObjectId, ref: 'User', index: true },
name: { required: true, type: String },
avatar: { required: true, type: String },
username: { type: String }, // if they are an expert
tw: { type: String },
gh: { type: String },
in: { type: String },
gp: { type: String },
bio: { type: String }
};
export default mongoose.model('Post', new mongoose.Schema({
by: { required: true, type: Author },
created: { required: true, type: Date, 'default': Date },
updated: { required: true, type: Date, 'default': Date },
published: { type: Date },
publishedBy: { type: ObjectId, ref: 'User' },
slug: { type: String, unique: true, sparse: true },
title: { required: true, type: String },
md: { required: true, type: String },
assetUrl: { type: String },
tags: { type: [{}], 'default': [] },
}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment