Skip to content

Instantly share code, notes, and snippets.

@Kernix13
Created March 31, 2024 15:01
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 Kernix13/8284414f549a3a0598d0cefc7b723dfe to your computer and use it in GitHub Desktop.
Save Kernix13/8284414f549a3a0598d0cefc7b723dfe to your computer and use it in GitHub Desktop.
Mongoose model and schema
// npm i express mongoose
// create a /models folder, inside create retreat.js,
// model name = 'Retreat', the schema = RetreatSchema
const mongoose = require('mongoose');
const { Schema } = mongoose;
const RetreatSchema = new mongoose.Schema({
title: String,
image: String,
price: Number,
description: String,
location: String,
type: String,
date: String,
events: String,
});
module.exports = mongoose.model('Retreat', RetreatSchema);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment