var mongoose = require('mongoose'); var Schema = mongoose.Schema; module.exports.schema = new Schema({ name: {type: String, required: true}, urlslug: {type: String, required: true, lowercase: true, unique: true}, productImage: {type: String, required: true}, description: {type: String, required: true}, numberInStock: {type: Number}, price: {type: Number}, images: [String], //Does not include productImage tags: [String], publishTime:{type: Number, required: true}, expireTime:{type: Number, required: true}, preorderDate: {type: Number, default: null} }); module.exports.schema.index({name: 'text', description: 'text'}); module.exports.model = mongoose.model('Sock', module.exports.schema);