Skip to content

Instantly share code, notes, and snippets.

@danielkhan
Created June 6, 2018 15:35
Show Gist options
  • Save danielkhan/bdb45d0ed35969a9ed2329fdbabe9cbc to your computer and use it in GitHub Desktop.
Save danielkhan/bdb45d0ed35969a9ed2329fdbabe9cbc to your computer and use it in GitHub Desktop.
const mongoose = require('mongoose');
const ContactSchema = mongoose.Schema({
user_id: {
type: mongoose.Schema.ObjectId,
required: true,
},
firstname: {
type: String,
required: true,
lowercase: true,
trim: true,
},
lastname: {
type: String,
required: true,
lowercase: true,
trim: true,
},
street: {
type: String,
required: true,
lowercase: true,
trim: true,
},
zip: {
type: String,
required: true,
lowercase: true,
trim: true,
},
city: {
type: String,
required: true,
lowercase: true,
trim: true,
},
email: {
type: String,
required: true,
lowercase: true,
trim: true,
},
}, { timestamps: true });
module.exports = mongoose.model('Contact', ContactSchema);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment