Created
March 31, 2024 15:01
-
-
Save Kernix13/8284414f549a3a0598d0cefc7b723dfe to your computer and use it in GitHub Desktop.
Mongoose model and schema
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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