api/resources/Informations/InformationModel.js
2023-02-23 21:49:09 +05:30

28 lines
751 B
JavaScript

import mongoose from "mongoose";
const { Schema, model } = mongoose;
const informationSchema = new mongoose.Schema(
{
title: {
type: String,
maxLength: [150, "title cannot exceed 25 characters"],
required: [true, "Please Enter title "],
},
description: {
type: String,
maxLength: [500, "description cannot exceed 500 characters"],
required: [true, "Please Enter product description"],
},
user: {
type: Schema.Types.ObjectId,
ref: "User"
},
},
{ timestamps: true, versionKey: false }
);
export const Information = mongoose.model("Information", informationSchema);