Working with Mongoose schema
1 min readJan 15, 2020
const mongoose = require(“mongoose”);
const Schema = mongoose.Schema;
const panel = new Schema({
techStack: { type: String, required: true, trim: true, validate: /^[⁰-9\s]+(\s*[⁰-9]+)*$/ },
people: { type: [String], required: true, trim: true, validate: /^[⁰-9\s]+(\s*[⁰-9]+)*$/ },
interviews: { type: [String], trim: true, lowercase: true, validate: /^[⁰-9\s]+(\s*[⁰-9]+)*$/ }}, { strict: false, timestamps: true });
const panelModel = mongoose.model(“panels”, panel, “panels”);
module.exports.panelModel = panelModel;