const Schema = mongoose.Schema;
const workoutSchema = new Schema({
title : {
type: String,
required: true
},
reps : {
type: Number,
required: true
},
load : {
type: Number,
required: true
}
}, {timestamps: true})
module.exports = mongoose.model("Workout", workoutSchema)
Associated Context | |
---|---|
Type | Code Snippet ( .js ) |
Associated Tags | Mongoose Schema Workout Model Title Field Reps Field Load Field Timestamps Property Data Validation Object-Oriented Programming TypeScript Classes Framework: Mongoose mongoose schema workout model |
💡 Smart Description | This code snippet defines a Mongoose schema called "Workout" that contains properties for title, reps, load, and timestamps. It also exports the model to be used in MongoDB's workout library. Defining a Mongoose schema for a workout model with title, reps, and load fields. |
🔎 Suggested Searches | Mongoose model workout schema How to create a Workout Schema in mongoose Mongoose models for creating anWorkoutSchema MongoDB Model with required fields and timestamps Example code for creating a DataModel from the database Mongoose Schema workout model Node.js workout model schema Mongoose model timestamps |
Related Links | https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error https://mongoosejs.com/docs/api.html#model_Model.findOne https://www.freecodecamp.org/news/introduction-to-mongoose-for-mongodb-d2a7aa593c57/ https://mongoosejs.com/docs/schematypes.html |
Related People | Umer Khokhar |
Sensitive Information | No Sensitive Information Detected |
Shareable Link | https://khokhar.pieces.cloud/?p=ad444c9024 |